/[cvs]/nfo/projects/netfraggle/bin/fraggleViewport.py
ViewVC logotype

Diff of /nfo/projects/netfraggle/bin/fraggleViewport.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by joko, Wed Aug 25 22:53:41 2004 UTC revision 1.18 by xabbu, Sat Sep 4 20:26:01 2004 UTC
# Line 1  Line 1 
1  4#Boa:MDIParent:fraggleViewport  #Boa:MDIParent:fraggleViewport
2    
3    # $Id$
4    # $Log$
5    # Revision 1.18  2004/09/04 20:26:01  xabbu
6    # +Added a button to the Preferences tab for showing the Modules Dialog.
7    #  Todo: When the module dialog is shown, it is still being blocked by the    preferences dialog. I am not sure why but will have to look into it further.
8    #
9    # +Added modules directory
10    #
11    # Revision 1.17  2004/09/01 21:43:30  xabbu
12    # +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience
13    # +FraggleCtlModules class creation for handling content modules
14    #
15    # Revision 1.16  2004/08/30 13:06:40  joko
16    # U now gets preferences via self.engine
17    #
18    # Revision 1.15  2004/08/27 21:14:02  xabbu
19    # TopicDetails can now be closed.
20    # GUI change on Preferences Dialog in order to prepare multiple server profiles.
21    # Small bugfixes to get the new topic windows working on posix platform.
22    #
23    # Revision 1.14  2004/08/27 04:39:06  joko
24    # cleanup
25    #
26    # Revision 1.13  2004/08/27 03:25:44  joko
27    # added FraggleTaskBarMenu
28    #
29    # Revision 1.12  2004/08/27 00:05:22  joko
30    # fix for icon-path and wxTaskBarIcon-events
31    #
32    # Revision 1.11  2004/08/26 23:10:12  xabbu
33    # xmlrpc class added
34    #
35    # Revision 1.10  2004/08/26 18:19:27  joko
36    # now using FraggleTopicFrame
37    #
38    # Revision 1.9  2004/08/26 15:21:13  joko
39    # renamed namespaces
40    # added key shortcuts to menu-items
41    # correct "showAbout" code
42    #
43    
44  import os  import os
45  from wxPython.wx import *  from wxPython.wx import *
46    from wxPython.stc import *
47    
48    from fraggleConstants import *
49  import fraggleDialogPrefs  import fraggleDialogPrefs
50  import fraggleCtlPreferences  import FraggleDialogModules
51  from fraggleDialogs import *  import FraggleAboutDialog
52    import FraggleTopicFrame
53    import FraggleXMLRPC
54    
55  def create(parent):  def create(parent):
56      return fraggleMainWin(parent)      return fraggleViewport(parent)
57    
58  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))
59    
60  [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,  [wxID_FRAGGLEVIEWPORTMENU1FMODULES, wxID_FRAGGLEVIEWPORTMENU1FPREFS,
61  ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))   wxID_FRAGGLEVIEWPORTMENU1ITEMS1,
62    ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(3))
63    
64    [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
65    ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
66    
67  [wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT,  [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
68  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
69    
70    [wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT,
71     wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE,
72     wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC,
73    ] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3))
74    
75  class fraggleViewport(wxMDIParentFrame):  class fraggleViewport(wxMDIParentFrame):
76      def _init_coll_menu1_Items(self, parent):      def _init_coll_FraggleTaskBarMenu_Items(self, parent):
77          # generated method, don't edit          # generated method, don't edit
           
         parent.Append(helpString='Configure Netfraggle',  
               id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',  
               kind=wxITEM_NORMAL)  
         parent.Append(helpString='Exit Netfraggle',  
               id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',  
               kind=wxITEM_NORMAL)  
78    
79          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)          parent.Append(helpString='Restore',
80          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu)                id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE,
81                  item='Restore', kind=wxITEM_NORMAL)
82            parent.Append(helpString='Sync enabled',
83                  id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC,
84                  item='Sync enabled', kind=wxITEM_CHECK)
85            parent.Append(helpString='Exit',
86                  id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit',
87                  kind=wxITEM_NORMAL)
88    
89      def _init_coll_menu2_Items(self, parent):      def _init_coll_menu2_Items(self, parent):
90          # generated method, don't edit          # generated method, don't edit
91    
92          parent.Append(helpString='Documentation',          parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT,
93                id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents',                item='Contents', kind=wxITEM_NORMAL)
94            parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT,
95                  item='About', kind=wxITEM_NORMAL)
96    
97        def _init_coll_menu1_Items(self, parent):
98            # generated method, don't edit
99    
100            parent.Append(helpString='Configure Modules',
101                  id=wxID_FRAGGLEVIEWPORTMENU1FMODULES, item='Modules',
102                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
103          parent.Append(helpString='About Netfraggle',          parent.Append(helpString='Configure Netfraggle',
104                id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About',                id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',
105                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
106                        parent.Append(helpString='Exit Netfraggle',
107          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)                id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',
108          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)                kind=wxITEM_NORMAL)
109            EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FMODULES,
110                  self.OnMenu1FmodulesMenu)
111            EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1FprefsMenu)
112            EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1Items1Menu)
113    
114      def _init_coll_menuBar1_Menus(self, parent):      def _init_coll_menuBar1_Menus(self, parent):
115          # generated method, don't edit          # generated method, don't edit
116    
117          parent.Append(menu=self.menu1, title='File')          parent.Append(menu=self.menu1, title='&File')
118          parent.Append(menu=self.menu2, title='Help')          parent.Append(menu=self.menu2, title='&Help')
119    
120      def _init_utils(self):      def _init_utils(self):
121          # generated method, don't edit          # generated method, don't edit
# Line 57  class fraggleViewport(wxMDIParentFrame): Line 123  class fraggleViewport(wxMDIParentFrame):
123          self.menuBar1.SetAutoLayout(1)          self.menuBar1.SetAutoLayout(1)
124    
125          self.menu1 = wxMenu(title='')          self.menu1 = wxMenu(title='')
         self._init_coll_menu1_Items(self.menu1)  
126    
127          self.menu2 = wxMenu(title='')          self.menu2 = wxMenu(title='')
128          self._init_coll_menu2_Items(self.menu2)  
129            self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle')
130    
131          self._init_coll_menuBar1_Menus(self.menuBar1)          self._init_coll_menuBar1_Menus(self.menuBar1)
132            self._init_coll_menu1_Items(self.menu1)
133            self._init_coll_menu2_Items(self.menu2)
134            self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu)
135    
136      def _init_ctrls(self, prnt):      def _init_ctrls(self, prnt):
137          # generated method, don't edit          # generated method, don't edit
138          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,
139                name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313),                name='fraggleViewport', parent=prnt, pos=wxPoint(335, 382),
140                size=wxSize(683, 307),                size=wxSize(435, 273),
141                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
142                title='wxMDIParentFrame1')                title='NetFraggle 0.0.1')
143          self._init_utils()          self._init_utils()
144          self.SetClientSize(wxSize(683, 284))          self.SetClientSize(wxSize(427, 246))
145          self.SetMenuBar(self.menuBar1)          self.SetMenuBar(self.menuBar1)
146    
147        def __init_modules__(self):
148            self.modulesCtl = self.engine.modules
149            self.dialogModules = FraggleDialogModules.create(self)
150            
151      def __init_preferences__(self):      def __init_preferences__(self):
152          self.preferencesCtl = fraggleCtlPreferences.create(self)          self.preferencesCtl = self.engine.preferences
153          self.dialogPrefs = fraggleDialogPrefs.create(self)          self.dialogPrefs = fraggleDialogPrefs.create(self)
154          self.dialogPrefs.loadConfig()          self.dialogPrefs.loadConfig()
155          self.dialogPrefs.updateConfig()          self.dialogPrefs.updateConfig()
156    
157            # new as of 2004-08-26: TopicFrame
158            # new as of 2004-08-27: pass configList to TopicFrame
159            self.topicFrame = FraggleTopicFrame.create(self)
160            self.topicFrame.Move(wxPoint(5, 5))
161            
162            #frame.Show()
163            #frame.Destroy()
164        def __init_xmlrpc__(self):
165            #self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList)
166            pass
167                    
168        def __init_taskbar_icon__(self):
169            if os.name == 'posix':
170                pass
171            elif os.name == 'nt':
172                self.tbicon = wxTaskBarIcon()
173                #icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO)
174                icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO)
175                self.tbicon.SetIcon(icon, '')
176                EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick)
177                EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick)
178                EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore)
179                EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit)
180                
181      def __init__(self, parent):      def __init__(self, parent):
182            import __main__
183            self.engine = __main__.engine
184          self._init_ctrls(parent)          self._init_ctrls(parent)
185            self.__init_modules__()
186          self.__init_preferences__()          self.__init_preferences__()
187            self.__init_taskbar_icon__()
188      def showPrefs(self, event):          self.__init_xmlrpc__()
189          """Show preferences screen"""          
190        def OnMenu1items0Menu(self, event):
191          try:          try:
192              self.dialogPrefs.ShowModal()              self.dialogPrefs.ShowModal()
193          finally:          finally:
194              self.dialogPrefs.Destroy()              self.dialogPrefs.Hide()
195          #event.Skip()          event.Skip()
           
     def showHelp(self):  
         """Show help"""  
         try:  
             import webbrowser  
             webbrowser.open("file://"+os.path.join(PEARSLOCATION, "docs/index.html"), 1)  
         except:  
             dlg = wxScrolledMessageDialog(parent=self,  
                     caption="Help",  
                     msg="""PEARS - alternative help (see the docs directory in your Pears folder for more elaborate information)  
                       
     Pears is a relatively simple three-pane news feed aggregator (RSS/RDF reader).  
           
     The left pane contains the list of feeds. You can add feeds using the Feeds menu. Right-click on a feed to update, single-click to view cached contents.  
           
     The right pane contains a list of the topics available in the feed. Single-click to open the contents of a topic in the viewer window at the bottom. Right-click to toggle read/unread status.  
           
     Everything is cached in Python structures stored as plain text in your Home directory (in a subdirectory called '.pears'). Use the About screen to see exactly where that is on your system.  
     """)  
             dlg.ShowModal()  
             dlg.Destroy()  
           
     def showAbout(self):  
         """Show about screen"""  
         dlg = AboutDialog(parent=self, id=-1, title="About Pears")  
         dlg.ShowModal()  
         dlg.Destroy()  
           
     def doExit(self):  
         """Shut down the program"""  
         self.Close(True)  
         self.Destroy()  
           
     def OnMenu1items0Menu(self, event):  
         self.showPrefs(event)  
         #event.Skip()  
196    
197      def OnMenu1items1Menu(self, event):      def OnMenu1items1Menu(self, event):
198          self.doExit()          self.Destroy()
199            event.Skip()
200    
201    
202      def OnMenu2items0Menu(self, event):      def OnMenu2items0Menu(self, event):
203          self.showHelp()          try:
204                self.dialogPrefs.ShowModal()
205            finally:
206                pass
207            event.Skip()
208    
209      def OnMenu2items1Menu(self, event):      def OnMenu2items1Menu(self, event):
210          self.showAbout()          """Show about screen"""
211            dlg = FraggleAboutDialog.create(self)
212  class fraggleMainWin(fraggleViewport):          dlg.ShowModal()
213      def _init_coll_menu1_Items(self, parent):          dlg.Destroy()
214    
215          if os.name == 'posix':      def OnTaskBarLeftDClick(self, event):
216              super(fraggleMainWin, self)._init_coll_menu1_Items(parent)          #event.Skip()
217          elif os.name == 'nt':          #self.SetFocus()
218              parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Configure Netfraggle', "", wxITEM_NORMAL)          if self.IsIconized():
219              parent.Append(wxID_FRAGGLEVIEWPORTMENU1ITEMS1, 'Exit Netfraggle', "", wxITEM_NORMAL)              self.Restore()
220            else:
221                self.Iconize()
222            
223        def OnTaskBarRightClick(self, event):
224            #event.Skip()
225            self.tbicon.PopupMenu(self.FraggleTaskBarMenu)
226            
227        def OnTaskBarAppRestore(self, event):
228            self.Restore()
229            #event.Skip()
230    
231          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)      def OnTaskBarAppExit(self, event):
232          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu)          #event.Skip()
233            #self.Destroy()
234            self.Close(True)
235    
236      def _init_coll_menu2_Items(self, parent):      def OnMenu1FmodulesMenu(self, event):
237            event.Skip()
238    
239          if os.name == 'posix':      def OnMenu1FprefsMenu(self, event):
240              super(fraggleMainWin, self)._init_coll_menu2_Items(parent)          event.Skip()
         elif os.name == 'nt':  
             parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL)  
             parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL)  
               
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)  
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)  
241    
242        def OnMenu1Items1Menu(self, event):
243            event.Skip()
244            

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.18

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed