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

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

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