/[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.16 by joko, Mon Aug 30 13:06:40 2004 UTC
# Line 1  Line 1 
1  4#Boa:MDIParent:fraggleViewport  #Boa:MDIParent:fraggleViewport
2    
3    # $Id$
4    # $Log$
5    # Revision 1.16  2004/08/30 13:06:40  joko
6    # U now gets preferences via self.engine
7    #
8    # Revision 1.15  2004/08/27 21:14:02  xabbu
9    # TopicDetails can now be closed.
10    # GUI change on Preferences Dialog in order to prepare multiple server profiles.
11    # Small bugfixes to get the new topic windows working on posix platform.
12    #
13    # Revision 1.14  2004/08/27 04:39:06  joko
14    # cleanup
15    #
16    # Revision 1.13  2004/08/27 03:25:44  joko
17    # added FraggleTaskBarMenu
18    #
19    # Revision 1.12  2004/08/27 00:05:22  joko
20    # fix for icon-path and wxTaskBarIcon-events
21    #
22    # Revision 1.11  2004/08/26 23:10:12  xabbu
23    # xmlrpc class added
24    #
25    # Revision 1.10  2004/08/26 18:19:27  joko
26    # now using FraggleTopicFrame
27    #
28    # Revision 1.9  2004/08/26 15:21:13  joko
29    # renamed namespaces
30    # added key shortcuts to menu-items
31    # correct "showAbout" code
32    #
33    
34  import os  import os
35  from wxPython.wx import *  from wxPython.wx import *
36    from wxPython.stc import *
37    
38    from fraggleConstants import *
39  import fraggleDialogPrefs  import fraggleDialogPrefs
40  import fraggleCtlPreferences  import FraggleAboutDialog
41  from fraggleDialogs import *  import FraggleTopicFrame
42    import FraggleXMLRPC
43    
44  def create(parent):  def create(parent):
45      return fraggleMainWin(parent)      return fraggleViewport(parent)
46    
47  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))
48    
49  [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,  [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,
50  ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))  ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))
51    
52  [wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT,  [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
53    ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
54    
55    [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
56  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
57    
58    [wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT,
59     wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE,
60     wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC,
61    ] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3))
62    
63  class fraggleViewport(wxMDIParentFrame):  class fraggleViewport(wxMDIParentFrame):
64      def _init_coll_menu1_Items(self, parent):      def _init_coll_FraggleTaskBarMenu_Items(self, parent):
65          # 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)  
66    
67          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)          parent.Append(helpString='Restore',
68          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu)                id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE,
69                  item='Restore', kind=wxITEM_NORMAL)
70            parent.Append(helpString='Sync enabled',
71                  id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC,
72                  item='Sync enabled', kind=wxITEM_CHECK)
73            parent.Append(helpString='Exit',
74                  id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit',
75                  kind=wxITEM_NORMAL)
76    
77      def _init_coll_menu2_Items(self, parent):      def _init_coll_menu2_Items(self, parent):
78          # generated method, don't edit          # generated method, don't edit
79    
80          parent.Append(helpString='Documentation',          parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT,
81                id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents',                item='Contents', kind=wxITEM_NORMAL)
82            parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT,
83                  item='About', kind=wxITEM_NORMAL)
84    
85        def _init_coll_menu1_Items(self, parent):
86            # generated method, don't edit
87    
88            parent.Append(helpString='Configure Netfraggle',
89                  id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',
90                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
91          parent.Append(helpString='About Netfraggle',          parent.Append(helpString='Exit Netfraggle',
92                id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About',                id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',
93                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
               
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)  
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)  
94    
95      def _init_coll_menuBar1_Menus(self, parent):      def _init_coll_menuBar1_Menus(self, parent):
96          # generated method, don't edit          # generated method, don't edit
97    
98          parent.Append(menu=self.menu1, title='File')          parent.Append(menu=self.menu1, title='&File')
99          parent.Append(menu=self.menu2, title='Help')          parent.Append(menu=self.menu2, title='&Help')
100    
101      def _init_utils(self):      def _init_utils(self):
102          # generated method, don't edit          # generated method, don't edit
# Line 62  class fraggleViewport(wxMDIParentFrame): Line 109  class fraggleViewport(wxMDIParentFrame):
109          self.menu2 = wxMenu(title='')          self.menu2 = wxMenu(title='')
110          self._init_coll_menu2_Items(self.menu2)          self._init_coll_menu2_Items(self.menu2)
111    
112            self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle')
113            self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu)
114    
115          self._init_coll_menuBar1_Menus(self.menuBar1)          self._init_coll_menuBar1_Menus(self.menuBar1)
116    
117      def _init_ctrls(self, prnt):      def _init_ctrls(self, prnt):
118          # generated method, don't edit          # generated method, don't edit
119          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,
120                name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313),                name='fraggleViewport', parent=prnt, pos=wxPoint(335, 382),
121                size=wxSize(683, 307),                size=wxSize(427, 269),
122                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
123                title='wxMDIParentFrame1')                title='NetFraggle 0.0.1')
124          self._init_utils()          self._init_utils()
125          self.SetClientSize(wxSize(683, 284))          self.SetClientSize(wxSize(427, 246))
126          self.SetMenuBar(self.menuBar1)          self.SetMenuBar(self.menuBar1)
127    
128      def __init_preferences__(self):      def __init_preferences__(self):
129          self.preferencesCtl = fraggleCtlPreferences.create(self)          self.preferencesCtl = self.engine.preferences
130          self.dialogPrefs = fraggleDialogPrefs.create(self)          self.dialogPrefs = fraggleDialogPrefs.create(self)
131          self.dialogPrefs.loadConfig()          self.dialogPrefs.loadConfig()
132          self.dialogPrefs.updateConfig()          self.dialogPrefs.updateConfig()
133    
134            # new as of 2004-08-26: TopicFrame
135            # new as of 2004-08-27: pass configList to TopicFrame
136            self.topicFrame = FraggleTopicFrame.create(self)
137            self.topicFrame.Move(wxPoint(5, 5))
138            
139            #frame.Show()
140            #frame.Destroy()
141        def __init_xmlrpc__(self):
142            #self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList)
143            pass
144                    
145        def __init_taskbar_icon__(self):
146            if os.name == 'posix':
147                pass
148            elif os.name == 'nt':
149                self.tbicon = wxTaskBarIcon()
150                #icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO)
151                icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO)
152                self.tbicon.SetIcon(icon, '')
153                EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick)
154                EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick)
155                EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore)
156                EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit)
157                
158      def __init__(self, parent):      def __init__(self, parent):
159            import __main__
160            self.engine = __main__.engine
161          self._init_ctrls(parent)          self._init_ctrls(parent)
162          self.__init_preferences__()          self.__init_preferences__()
163            self.__init_taskbar_icon__()
164      def showPrefs(self, event):          self.__init_xmlrpc__()
165          """Show preferences screen"""          
166        def OnMenu1items0Menu(self, event):
167          try:          try:
168              self.dialogPrefs.ShowModal()              self.dialogPrefs.ShowModal()
169          finally:          finally:
170              self.dialogPrefs.Destroy()              self.dialogPrefs.Hide()
171          #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()  
172    
173      def OnMenu1items1Menu(self, event):      def OnMenu1items1Menu(self, event):
174          self.doExit()          self.Destroy()
175            event.Skip()
176    
177    
178      def OnMenu2items0Menu(self, event):      def OnMenu2items0Menu(self, event):
179          self.showHelp()          try:
180                self.dialogPrefs.ShowModal()
181            finally:
182                pass
183            event.Skip()
184    
185      def OnMenu2items1Menu(self, event):      def OnMenu2items1Menu(self, event):
186          self.showAbout()          """Show about screen"""
187            dlg = FraggleAboutDialog.create(self)
188  class fraggleMainWin(fraggleViewport):          dlg.ShowModal()
189      def _init_coll_menu1_Items(self, parent):          dlg.Destroy()
   
         if os.name == 'posix':  
             super(fraggleMainWin, self)._init_coll_menu1_Items(parent)  
         elif os.name == 'nt':  
             parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Configure Netfraggle', "", wxITEM_NORMAL)  
             parent.Append(wxID_FRAGGLEVIEWPORTMENU1ITEMS1, 'Exit Netfraggle', "", wxITEM_NORMAL)  
   
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)  
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu)  
   
     def _init_coll_menu2_Items(self, parent):  
190    
191          if os.name == 'posix':      def OnTaskBarLeftDClick(self, event):
192              super(fraggleMainWin, self)._init_coll_menu2_Items(parent)          #event.Skip()
193          elif os.name == 'nt':          #self.SetFocus()
194              parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL)          if self.IsIconized():
195              parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL)              self.Restore()
196                        else:
197          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)              self.Iconize()
198          EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)          
199        def OnTaskBarRightClick(self, event):
200            #event.Skip()
201            self.tbicon.PopupMenu(self.FraggleTaskBarMenu)
202            
203        def OnTaskBarAppRestore(self, event):
204            self.Restore()
205            #event.Skip()
206    
207        def OnTaskBarAppExit(self, event):
208            #event.Skip()
209            #self.Destroy()
210            self.Close(True)
211            

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

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