/[cvs]/nfo/projects/netfraggle/bin/fraggleViewport.py
ViewVC logotype

Contents of /nfo/projects/netfraggle/bin/fraggleViewport.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations)
Thu Aug 26 23:10:12 2004 UTC (19 years, 10 months ago) by xabbu
Branch: MAIN
Changes since 1.10: +59 -10 lines
File MIME type: text/x-python
xmlrpc class added

1 #Boa:MDIParent:fraggleViewport
2
3 # $Id: fraggleViewport.py,v 1.10 2004/08/26 18:19:27 joko Exp $
4 # $Log: fraggleViewport.py,v $
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
15 from wxPython.wx import *
16 from wxPython.stc import *
17
18 import fraggleDialogPrefs
19 import fraggleCtlPreferences
20 import FraggleAboutDialog
21 import FraggleTopicFrame
22 import FraggleXMLRPC
23
24 def create(parent):
25 return fraggleViewport(parent)
26
27 [wxID_FRAGGLEVIEWPORT, wxID_FRAGGLEVIEWPORTBUTTONSYNC,
28 wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1,
29 ] = map(lambda _init_ctrls: wxNewId(), range(3))
30
31 [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,
32 ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2))
33
34 [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
35 ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
36
37 [wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT,
38 ] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2))
39
40 class fraggleViewport(wxMDIParentFrame):
41 def _init_coll_menu2_Items(self, parent):
42 # generated method, don't edit
43
44 parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT,
45 item='Contents', kind=wxITEM_NORMAL)
46 parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT,
47 item='About', kind=wxITEM_NORMAL)
48
49 def _init_coll_menu1_Items(self, parent):
50 # generated method, don't edit
51
52 parent.Append(helpString='Configure Netfraggle',
53 id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences',
54 kind=wxITEM_NORMAL)
55 parent.Append(helpString='Exit Netfraggle',
56 id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit',
57 kind=wxITEM_NORMAL)
58
59 def _init_coll_menuBar1_Menus(self, parent):
60 # generated method, don't edit
61
62 parent.Append(menu=self.menu1, title='&File')
63 parent.Append(menu=self.menu2, title='&Help')
64
65 def _init_utils(self):
66 # generated method, don't edit
67 self.menuBar1 = wxMenuBar()
68 self.menuBar1.SetAutoLayout(1)
69
70 self.menu1 = wxMenu(title='')
71 self._init_coll_menu1_Items(self.menu1)
72
73 self.menu2 = wxMenu(title='')
74 self._init_coll_menu2_Items(self.menu2)
75
76 self._init_coll_menuBar1_Menus(self.menuBar1)
77
78 def _init_ctrls(self, prnt):
79 # generated method, don't edit
80 wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,
81 name='fraggleViewport', parent=prnt, pos=wxPoint(525, 292),
82 size=wxSize(341, 296),
83 style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
84 title='NetFraggle 0.0.1')
85 self._init_utils()
86 self.SetClientSize(wxSize(341, 273))
87 self.SetMenuBar(self.menuBar1)
88
89 self.buttonsync = wxButton(id=wxID_FRAGGLEVIEWPORTBUTTONSYNC,
90 label='Sync', name='buttonsync', parent=self, pos=wxPoint(104,
91 240), size=wxSize(136, 24), style=0)
92 EVT_BUTTON(self.buttonsync, wxID_FRAGGLEVIEWPORTBUTTONSYNC,
93 self.OnButtonsyncButton)
94
95 self.styledTextCtrl1 = wxStyledTextCtrl(id=wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1,
96 name='styledTextCtrl1', parent=self, pos=wxPoint(8, 16),
97 size=wxSize(328, 216), style=0)
98
99 def __init_preferences__(self):
100 self.preferencesCtl = fraggleCtlPreferences.create(self)
101 self.dialogPrefs = fraggleDialogPrefs.create(self)
102 self.dialogPrefs.loadConfig()
103 self.dialogPrefs.updateConfig()
104
105 # new as of 2004-08-26: TopicFrame
106 self.topicFrame = FraggleTopicFrame.create(self)
107 self.topicFrame.Move(wxPoint(10, 10))
108
109 #frame.Show()
110 #frame.Destroy()
111 def __init_xmlrpc__(self):
112 self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList)
113
114 def __init_taskbar_icon__(self):
115 if os.name == 'posix':
116 pass
117 elif os.name == 'nt':
118 self.tbicon = wxTaskBarIcon()
119 icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO)
120 self.tbicon.SetIcon(icon, '')
121 wxEVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick)
122 wxEVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick)
123
124 def __init__(self, parent):
125 self._init_ctrls(parent)
126 self.__init_preferences__()
127 self.__init_taskbar_icon__()
128 self.__init_xmlrpc__()
129
130 def OnMenu1items0Menu(self, event):
131 try:
132 self.dialogPrefs.ShowModal()
133 finally:
134 self.dialogPrefs.Hide()
135 event.Skip()
136
137 def OnMenu1items1Menu(self, event):
138 self.Destroy()
139 event.Skip()
140
141
142 def OnMenu2items0Menu(self, event):
143 try:
144 self.dialogPrefs.ShowModal()
145 finally:
146 pass
147 event.Skip()
148
149 def OnMenu2items1Menu(self, event):
150 """Show about screen"""
151 dlg = FraggleAboutDialog.create(self)
152 dlg.ShowModal()
153 dlg.Destroy()
154
155 def OnTaskBarLeftDClick(self, event):
156 event.Skip()
157
158 def OnTaskBarRightClick(self, event):
159 event.Skip()
160
161 def OnButtonsyncButton(self, event):
162 fragglexml = self.xml_rpc.FraggleSync()
163 print fragglexml
164 import codecs
165 (UTF8_encode, UTF8_decode,
166 UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8')
167 text = UTF8_decode(repr(fragglexml))[0]
168 text = fragglexml.data
169 self.styledTextCtrl1.AddText(text)
170 event.Skip()

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