/[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.21 by xabbu, Tue Sep 21 18:12:19 2004 UTC
# Line 1  Line 1 
1  4#Boa:MDIParent:fraggleViewport  #Boa:MDIParent:fraggleViewport
2    
3    # $Id$
4    # $Log$
5    # Revision 1.21  2004/09/21 18:12:19  xabbu
6    # U in __init_modules  -> self.modulesCtl.SetViewport(self) will be set
7    #
8    # Revision 1.20  2004/09/05 10:09:26  xabbu
9    # + Bug that menues where displayed incorrectly on nt like os resolved.
10    # + Removed OS dependend menu creation in faggleMain -> moved to fraggleViewPort
11    # + Modules configuration dialog can be displayed by selecting Files->Modules now
12    #
13    # Revision 1.19  2004/09/05 00:21:10  xabbu
14    # +Fixed File Menu Modules item on Posix system. Gotta do testing on Windows with it.
15    #
16    # Revision 1.18  2004/09/04 20:26:01  xabbu
17    # +Added a button to the Preferences tab for showing the Modules Dialog.
18    #  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.
19    #
20    # +Added modules directory
21    #
22    # Revision 1.17  2004/09/01 21:43:30  xabbu
23    # +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience
24    # +FraggleCtlModules class creation for handling content modules
25    #
26    # Revision 1.16  2004/08/30 13:06:40  joko
27    # U now gets preferences via self.engine
28    #
29    # Revision 1.15  2004/08/27 21:14:02  xabbu
30    # TopicDetails can now be closed.
31    # GUI change on Preferences Dialog in order to prepare multiple server profiles.
32    # Small bugfixes to get the new topic windows working on posix platform.
33    #
34    # Revision 1.14  2004/08/27 04:39:06  joko
35    # cleanup
36    #
37    # Revision 1.13  2004/08/27 03:25:44  joko
38    # added FraggleTaskBarMenu
39    #
40    # Revision 1.12  2004/08/27 00:05:22  joko
41    # fix for icon-path and wxTaskBarIcon-events
42    #
43    # Revision 1.11  2004/08/26 23:10:12  xabbu
44    # xmlrpc class added
45    #
46    # Revision 1.10  2004/08/26 18:19:27  joko
47    # now using FraggleTopicFrame
48    #
49    # Revision 1.9  2004/08/26 15:21:13  joko
50    # renamed namespaces
51    # added key shortcuts to menu-items
52    # correct "showAbout" code
53    #
54    
55  import os  import os
56  from wxPython.wx import *  from wxPython.wx import *
57    from wxPython.stc import *
58    
59    from fraggleConstants import *
60  import fraggleDialogPrefs  import fraggleDialogPrefs
61  import fraggleCtlPreferences  import FraggleDialogModules
62  from fraggleDialogs import *  import FraggleAboutDialog
63    import FraggleTopicFrame
64    import FraggleXMLRPC
65    
66  def create(parent):  def create(parent):
67      return fraggleMainWin(parent)      return fraggleViewport(parent)
68    
69  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))
70    
71  [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,  [wxID_FRAGGLEVIEWPORTMENU1FMODULES, wxID_FRAGGLEVIEWPORTMENU1FPREFS,
72  ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))   wxID_FRAGGLEVIEWPORTMENU1ITEMS1,
73    ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(3))
74    
75    [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
76    ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
77    
78  [wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT,  [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
79  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
80    
81    [wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT,
82     wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE,
83     wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC,
84    ] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3))
85    
86  class fraggleViewport(wxMDIParentFrame):  class fraggleViewport(wxMDIParentFrame):
87      def _init_coll_menu1_Items(self, parent):      def _init_coll_FraggleTaskBarMenu_Items(self, parent):
88          # 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)  
89    
90          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)          parent.Append(helpString='Restore',
91          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu)                id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE,
92                  item='Restore', kind=wxITEM_NORMAL)
93            parent.Append(helpString='Sync enabled',
94                  id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC,
95                  item='Sync enabled', kind=wxITEM_CHECK)
96            parent.Append(helpString='Exit',
97                  id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit',
98                  kind=wxITEM_NORMAL)
99    
100      def _init_coll_menu2_Items(self, parent):      def _init_coll_menu2_Items(self, parent):
101          # generated method, don't edit          # generated method, don't edit
102    
103          parent.Append(helpString='Documentation',          parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT,
104                id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents',                item='Contents', kind=wxITEM_NORMAL)
105            parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT,
106                  item='About', kind=wxITEM_NORMAL)
107    
108        def _init_coll_menu1_Items(self, parent):
109            # generated method, don't edit
110    
111            parent.Append(helpString='Configure Modules',
112                  id=wxID_FRAGGLEVIEWPORTMENU1FMODULES, item='Modules',
113                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
114          parent.Append(helpString='About Netfraggle',          parent.Append(helpString='Configure Netfraggle',
115                id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About',                id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',
116                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
117                        parent.Append(helpString='Exit Netfraggle',
118          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)                id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',
119          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)                kind=wxITEM_NORMAL)
120            EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FMODULES,
121                  self.OnMenu1FmodulesMenu)
122            EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1FprefsMenu)
123            EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1Items1Menu)
124    
125      def _init_coll_menuBar1_Menus(self, parent):      def _init_coll_menuBar1_Menus(self, parent):
126          # generated method, don't edit          # generated method, don't edit
127    
128          parent.Append(menu=self.menu1, title='File')          parent.Append(menu=self.menu1, title='&File')
129          parent.Append(menu=self.menu2, title='Help')          parent.Append(menu=self.menu2, title='&Help')
130    
131      def _init_utils(self):      def _init_utils(self):
132          # generated method, don't edit          # generated method, don't edit
133          self.menuBar1 = wxMenuBar()          self.menuBar1 = wxMenuBar()
134          self.menuBar1.SetAutoLayout(1)          self.menuBar1.SetAutoLayout(0)
135    
136          self.menu1 = wxMenu(title='')          self.menu1 = wxMenu(title='')
         self._init_coll_menu1_Items(self.menu1)  
137    
138          self.menu2 = wxMenu(title='')          self.menu2 = wxMenu(title='')
139          self._init_coll_menu2_Items(self.menu2)  
140            self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle')
141    
142          self._init_coll_menuBar1_Menus(self.menuBar1)          self._init_coll_menuBar1_Menus(self.menuBar1)
143            self._init_coll_menu1_Items(self.menu1)
144            self._init_coll_menu2_Items(self.menu2)
145            self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu)
146    
147      def _init_ctrls(self, prnt):      def _init_ctrls(self, prnt):
148          # generated method, don't edit          # generated method, don't edit
149          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,
150                name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313),                name='fraggleViewport', parent=prnt, pos=wxPoint(335, 382),
151                size=wxSize(683, 307),                size=wxSize(435, 250),
152                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
153                title='wxMDIParentFrame1')                title='NetFraggle 0.0.1')
154          self._init_utils()          self._init_utils()
155          self.SetClientSize(wxSize(683, 284))          self.SetClientSize(wxSize(427, 223))
156          self.SetMenuBar(self.menuBar1)          self.SetMenuBar(self.menuBar1)
157    
158        def __init_modules__(self):
159            self.modulesCtl = self.engine.modules
160            self.modulesCtl.SetViewport(self)
161            self.dialogModules = FraggleDialogModules.create(self)
162            
163      def __init_preferences__(self):      def __init_preferences__(self):
164          self.preferencesCtl = fraggleCtlPreferences.create(self)          self.preferencesCtl = self.engine.preferences
165          self.dialogPrefs = fraggleDialogPrefs.create(self)          self.dialogPrefs = fraggleDialogPrefs.create(self)
166          self.dialogPrefs.loadConfig()          self.dialogPrefs.loadConfig()
167          self.dialogPrefs.updateConfig()          self.dialogPrefs.updateConfig()
168    
169            # new as of 2004-08-26: TopicFrame
170            # new as of 2004-08-27: pass configList to TopicFrame
171            self.topicFrame = FraggleTopicFrame.create(self)
172            self.topicFrame.Move(wxPoint(5, 5))
173            
174            #frame.Show()
175            #frame.Destroy()
176        def __init_xmlrpc__(self):
177            #self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList)
178            pass
179                    
180        def __init_taskbar_icon__(self):
181            if os.name == 'posix':
182                pass
183            elif os.name == 'nt':
184                self.tbicon = wxTaskBarIcon()
185                #icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO)
186                icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO)
187                self.tbicon.SetIcon(icon, '')
188                EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick)
189                EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick)
190                EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore)
191                EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit)
192                
193      def __init__(self, parent):      def __init__(self, parent):
194            import __main__
195            self.engine = __main__.engine
196          self._init_ctrls(parent)          self._init_ctrls(parent)
197            self.__init_modules__()
198          self.__init_preferences__()          self.__init_preferences__()
199            self.__init_taskbar_icon__()
200      def showPrefs(self, event):          self.__init_xmlrpc__()
201          """Show preferences screen"""          
202        def OnMenu1items0Menu(self, event):
203          try:          try:
204              self.dialogPrefs.ShowModal()              self.dialogPrefs.ShowModal()
205          finally:          finally:
206              self.dialogPrefs.Destroy()              self.dialogPrefs.Hide()
207          #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()  
208    
209      def OnMenu1items1Menu(self, event):      def OnMenu1items1Menu(self, event):
210          self.doExit()          self.Destroy()
211            event.Skip()
212    
     def OnMenu2items0Menu(self, event):  
         self.showHelp()  
213    
214      def OnMenu2items1Menu(self, event):      #def OnMenu2items0Menu(self, event):
215          self.showAbout()       #   try:
216          #      self.dialogPrefs.ShowModal()
217         #   finally:
218          #      pass
219          #  event.Skip()
220    
221  class fraggleMainWin(fraggleViewport):      def OnMenu2items1Menu(self, event):
222      def _init_coll_menu1_Items(self, parent):          """Show about screen"""
223            dlg = FraggleAboutDialog.create(self)
224            dlg.ShowModal()
225            dlg.Destroy()
226    
227          if os.name == 'posix':      def OnTaskBarLeftDClick(self, event):
228              super(fraggleMainWin, self)._init_coll_menu1_Items(parent)          #event.Skip()
229          elif os.name == 'nt':          #self.SetFocus()
230              parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Configure Netfraggle', "", wxITEM_NORMAL)          if self.IsIconized():
231              parent.Append(wxID_FRAGGLEVIEWPORTMENU1ITEMS1, 'Exit Netfraggle', "", wxITEM_NORMAL)              self.Restore()
232            else:
233                self.Iconize()
234            
235        def OnTaskBarRightClick(self, event):
236            #event.Skip()
237            self.tbicon.PopupMenu(self.FraggleTaskBarMenu)
238            
239        def OnTaskBarAppRestore(self, event):
240            self.Restore()
241            #event.Skip()
242    
243          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)      def OnTaskBarAppExit(self, event):
244          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu)          #event.Skip()
245            #self.Destroy()
246            self.Close(True)
247    
248      def _init_coll_menu2_Items(self, parent):      def OnMenu1FmodulesMenu(self, event):
249            self.dialogModules.Show()
250            event.Skip()
251    
252          if os.name == 'posix':      def OnMenu1FprefsMenu(self, event):
253              super(fraggleMainWin, self)._init_coll_menu2_Items(parent)          try:
254          elif os.name == 'nt':           self.dialogPrefs.ShowModal()
255              parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL)          finally:
256              parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL)            pass
257                        event.Skip()
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)  
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)  
258    
259        def OnMenu1Items1Menu(self, event):
260            self.Destroy()
261            event.Skip()
262            

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

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