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

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.13

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