/[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.10 by joko, Thu Aug 26 18:19:27 2004 UTC
# Line 1  Line 1 
1  4#Boa:MDIParent:fraggleViewport  #Boa:MDIParent:fraggleViewport
2    
3    # $Id$
4    # $Log$
5    # Revision 1.10  2004/08/26 18:19:27  joko
6    # now using FraggleTopicFrame
7    #
8    # Revision 1.9  2004/08/26 15:21:13  joko
9    # renamed namespaces
10    # added key shortcuts to menu-items
11    # correct "showAbout" code
12    #
13    
14  import os  import os
15  from wxPython.wx import *  from wxPython.wx import *
16    
17  import fraggleDialogPrefs  import fraggleDialogPrefs
18  import fraggleCtlPreferences  import fraggleCtlPreferences
19  from fraggleDialogs import *  import FraggleAboutDialog
20    import FraggleTopicFrame
21    
22  def create(parent):  def create(parent):
23      return fraggleMainWin(parent)      return fraggleViewport(parent)
24    
25  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))  [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))
26    
27  [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,  [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,
28  ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))  ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))
29    
30  [wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT,  [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
31  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))  ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
32    
33  class fraggleViewport(wxMDIParentFrame):  class fraggleViewport(wxMDIParentFrame):
34        def _init_coll_menu2_Items(self, parent):
35            # generated method, don't edit
36    
37            parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT,
38                  item='Contents', kind=wxITEM_NORMAL)
39            parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT,
40                  item='About', kind=wxITEM_NORMAL)
41    
42      def _init_coll_menu1_Items(self, parent):      def _init_coll_menu1_Items(self, parent):
43          # generated method, don't edit          # generated method, don't edit
44            
45          parent.Append(helpString='Configure Netfraggle',          parent.Append(helpString='Configure Netfraggle',
46                id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',                id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',
47                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
# Line 29  class fraggleViewport(wxMDIParentFrame): Line 49  class fraggleViewport(wxMDIParentFrame):
49                id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',                id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',
50                kind=wxITEM_NORMAL)                kind=wxITEM_NORMAL)
51    
         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='Documentation',  
               id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents',  
               kind=wxITEM_NORMAL)  
         parent.Append(helpString='About Netfraggle',  
               id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About',  
               kind=wxITEM_NORMAL)  
               
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu)  
         EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu)  
   
52      def _init_coll_menuBar1_Menus(self, parent):      def _init_coll_menuBar1_Menus(self, parent):
53          # generated method, don't edit          # generated method, don't edit
54    
55          parent.Append(menu=self.menu1, title='File')          parent.Append(menu=self.menu1, title='&File')
56          parent.Append(menu=self.menu2, title='Help')          parent.Append(menu=self.menu2, title='&Help')
57    
58      def _init_utils(self):      def _init_utils(self):
59          # generated method, don't edit          # generated method, don't edit
# Line 57  class fraggleViewport(wxMDIParentFrame): Line 61  class fraggleViewport(wxMDIParentFrame):
61          self.menuBar1.SetAutoLayout(1)          self.menuBar1.SetAutoLayout(1)
62    
63          self.menu1 = wxMenu(title='')          self.menu1 = wxMenu(title='')
         self._init_coll_menu1_Items(self.menu1)  
64    
65          self.menu2 = wxMenu(title='')          self.menu2 = wxMenu(title='')
         self._init_coll_menu2_Items(self.menu2)  
66    
67          self._init_coll_menuBar1_Menus(self.menuBar1)          self._init_coll_menuBar1_Menus(self.menuBar1)
68            self._init_coll_menu1_Items(self.menu1)
69            self._init_coll_menu2_Items(self.menu2)
70    
71      def _init_ctrls(self, prnt):      def _init_ctrls(self, prnt):
72          # generated method, don't edit          # generated method, don't edit
73          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,          wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,
74                name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313),                name='fraggleViewport', parent=prnt, pos=wxPoint(237, 287),
75                size=wxSize(683, 307),                size=wxSize(485, 310),
76                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,                style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
77                title='wxMDIParentFrame1')                title='NetFraggle')
78          self._init_utils()          self._init_utils()
79          self.SetClientSize(wxSize(683, 284))          self.SetClientSize(wxSize(477, 283))
80          self.SetMenuBar(self.menuBar1)          self.SetMenuBar(self.menuBar1)
81    
82      def __init_preferences__(self):      def __init_preferences__(self):
# Line 80  class fraggleViewport(wxMDIParentFrame): Line 84  class fraggleViewport(wxMDIParentFrame):
84          self.dialogPrefs = fraggleDialogPrefs.create(self)          self.dialogPrefs = fraggleDialogPrefs.create(self)
85          self.dialogPrefs.loadConfig()          self.dialogPrefs.loadConfig()
86          self.dialogPrefs.updateConfig()          self.dialogPrefs.updateConfig()
87    
88            # new as of 2004-08-26: TopicFrame
89            self.topicFrame = FraggleTopicFrame.create(self)
90            self.topicFrame.Move(wxPoint(10, 10))
91            
92            #frame.Show()
93            #frame.Destroy()
94                    
95      def __init__(self, parent):      def __init__(self, parent):
96          self._init_ctrls(parent)          self._init_ctrls(parent)
97          self.__init_preferences__()          self.__init_preferences__()
98            
99    
100      def showPrefs(self, event):      def OnMenu1items0Menu(self, event):
         """Show preferences screen"""  
101          try:          try:
102              self.dialogPrefs.ShowModal()              self.dialogPrefs.ShowModal()
103          finally:          finally:
104              self.dialogPrefs.Destroy()              pass
105          #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()  
106    
107      def OnMenu1items1Menu(self, event):      def OnMenu1items1Menu(self, event):
108          self.doExit()          self.Destroy()
109            event.Skip()
110    
111    
112      def OnMenu2items0Menu(self, event):      def OnMenu2items0Menu(self, event):
113          self.showHelp()          try:
114                self.dialogPrefs.ShowModal()
115            finally:
116                pass
117            event.Skip()
118    
119      def OnMenu2items1Menu(self, event):      def OnMenu2items1Menu(self, event):
120          self.showAbout()          """Show about screen"""
121            dlg = FraggleAboutDialog.create(self)
122  class fraggleMainWin(fraggleViewport):          dlg.ShowModal()
123      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):  
   
         if os.name == 'posix':  
             super(fraggleMainWin, self)._init_coll_menu2_Items(parent)  
         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)  
124    

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

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