11 builder
= gtk
.Builder()
12 builder
.add_from_file(conf
.d
['glade_file'])
13 self
.window
= builder
.get_object("window1")
14 self
.about
= builder
.get_object("aboutdialog1")
15 self
.tbconnect
=builder
.get_object("tbconnect")
16 self
.preferences_dialog
=builder
.get_object("preferences_dialog")
17 self
.preferences_dialog_align
= builder
.get_object("preferences_dialog_vbox")
18 self
.pd_entry
=builder
.get_object("pd_entry")
19 self
.pd_cb
=builder
.get_object("pd_cb")
20 self
.pd_cb_liststore
=builder
.get_object("pd_cb_liststore")
21 self
.l_message
=builder
.get_object("l_message")
22 self
.statusbar
=builder
.get_object("statusbar1")
23 self
.console_view
=builder
.get_object("console_view")
24 self
.console_text
=builder
.get_object("console_text")
25 builder
.connect_signals(self
)
27 self
.com
=COM(read_cbf
=self
.read_cbf
)
28 self
.tbconnect
.set_active(True)
30 def read_cbf(self
,data
):
33 #self.l_message.set_text(''.join(data))
35 str=re
.split('[^0-9]', str)
36 self
.statusbar
.push(0,''.join(str)+' seconds')
40 enditer
= ct
.get_end_iter()
41 ct
.insert(enditer
, str)
42 def on_btsend_clicked(self
, widget
, data
=None):
43 self
.com
.write("id?\r")
44 def on_tbconnect_clicked(self
, widget
, data
=None):
45 if widget
.get_active():
47 widget
.set_label("Connected")
50 widget
.set_label(" Closed")
51 def on_pd_cb_changed(self
, widget
, data
=None):
52 entry
=self
.pd_entry
#Preferences dialog combobox
54 active
=cb
.get_active_text()
55 entry
.set_text(conf
.d
[active
])
57 cb
=self
.pd_cb
#Fill in preferences dialog
58 liststore
= self
.pd_cb_liststore
60 liststore
.append([item
])
61 cb
.set_model(liststore
)
64 def on_preferences_dialog_show(self
, widget
, data
=None):
65 self
.preferences_dialog
.show()
66 def on_pd_set_bt_clicked(self
, widget
, data
=None):
69 active
=cb
.get_active_text()
70 conf
.d
[active
]=entry
.get_text()
72 def on_pd_close_bt_clicked(self
, widget
, data
=None):
73 self
.preferences_dialog
.hide()
74 def on_window1_destroy(self
, widget
, data
=None):
80 def on_aboutdialog1_show(self
, widget
, data
=None):
82 def on_aboutdialog1_response(self
, widget
, data
=None):
86 def __init__(self
,file):
88 def write(self
,arg
=None):
90 sys
.__stdout
__.write(arg
)
99 f
=open(d
['debug_file'],"w")
101 sys
.stderr
=sys
.stdout
104 fpickle
=open('config.pickle','r')
105 self
.d
=pickle
.load(fpickle
) # Dictionary
109 fpickle
=open('config.pickle','w')
110 #self.d['newitem']='newvalue'
111 pickle
.dump(self
.d
, fpickle
) # Dictionary
116 if __name__
=="__main__":
117 gtk
.gdk
.threads_init()
120 gtk
.gdk
.threads_enter()
122 gtk
.gdk
.threads_leave()