Skip to content

Commit

Permalink
updated j00dans UI
Browse files Browse the repository at this point in the history
  • Loading branch information
sweemeng committed Apr 13, 2011
1 parent 45d991e commit 9ccdee4
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions uploader/storyboard.py
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
import pygtk import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
#import serial


class StoryBoard: class StoryBoard:
def file_dialog(self, widget, file_name_entry): def file_dialog(self, widget, file_name_entry):
Expand Down Expand Up @@ -38,13 +39,21 @@ def entry_toggle_add(self, checkbutton, entry):
def entry_toggle_visibility(self, checkbutton, entry): def entry_toggle_visibility(self, checkbutton, entry):
entry.set_visibility(checkbutton.get_active()) entry.set_visibility(checkbutton.get_active())


#def file_processing
# add in one parameter for function # add in one parameter for function
def ok_button_callback(self, widget, file_name_entry): def ok_button_callback(self, widget, file_name_entry, port_name_entry):
file_name = file_name_entry.get_text() file_name = file_name_entry.get_text()
port_name = port_name_entry.get_text()
file = open(file_name, 'r') file = open(file_name, 'r')
packet = ""
for line in file: for line in file:
print line.rstrip() print line.rstrip()
packet += line.rstrip() + ':'
file.closed file.closed
print "packet: %s" % packet
#comm = serial.Serial(port_name, 9600)
#comm.write(packet)

# serial connection at here # serial connection at here




Expand Down Expand Up @@ -87,12 +96,12 @@ def __init__(self):
hbox.pack_start(port_label, False, False, 5) hbox.pack_start(port_label, False, False, 5)
port_label.show() port_label.show()


entry = gtk.Entry() port_name_entry = gtk.Entry()
entry.set_max_length(50) port_name_entry.set_max_length(50)
entry.connect("activate", self.enter_callback, entry) port_name_entry.connect("activate", self.enter_callback, port_name_entry)
port_name = entry.get_text() #port_name = port_name_entry.get_text()
hbox.pack_start(entry, False, False, 0) hbox.pack_start(port_name_entry, False, False, 0)
entry.show() port_name_entry.show()


hbox_filename = gtk.HBox(False, 0) hbox_filename = gtk.HBox(False, 0)
vbox.pack_start(hbox_filename) vbox.pack_start(hbox_filename)
Expand Down Expand Up @@ -127,7 +136,7 @@ def __init__(self):


# Buttons # Buttons
ok_button = gtk.Button(stock=gtk.STOCK_OK) ok_button = gtk.Button(stock=gtk.STOCK_OK)
ok_button.connect("clicked", self.ok_button_callback, file_name_entry) ok_button.connect("clicked", self.ok_button_callback, file_name_entry, port_name_entry)
hbox3.pack_start(ok_button, False, False, 0) hbox3.pack_start(ok_button, False, False, 0)
ok_button.show() ok_button.show()


Expand Down

0 comments on commit 9ccdee4

Please sign in to comment.