diff --git a/dstatInterface/dstatInterface.glade b/dstatInterface/dstatInterface.glade
new file mode 100644
index 0000000000000000000000000000000000000000..1f44d93079d37f868dcc67e996f6bf2707719c40
--- /dev/null
+++ b/dstatInterface/dstatInterface.glade
@@ -0,0 +1,409 @@
+
+
+
+
+
+
+
+
+ True
+ False
+ 0.47999998927116394
+ gtk-missing-image
+
+
+ False
+ 6
+ Main
+ 800
+ 500
+
+
+
+ True
+ False
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ False
+
+
+ True
+ False
+
+
+ True
+ False
+ Experiment
+
+
+ True
+ True
+ 10
+ 0
+
+
+
+
+ True
+ False
+ ExpComboListStore
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+ never
+ automatic
+
+
+
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+
+
+
+
+ True
+ True
+
+
+ True
+ False
+ label
+
+
+
+
+ True
+ False
+ page 1
+
+
+ False
+
+
+
+
+ True
+ True
+ automatic
+ automatic
+
+
+ True
+ True
+ False
+ databuffer1
+
+
+
+
+ 1
+
+
+
+
+ True
+ False
+ page 2
+
+
+ 1
+ False
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+
+
+
+
+ True
+ True
+ 1
+
+
+
+
+ True
+ False
+ 2
+
+
+ False
+ True
+ 2
+
+
+
+
+
+
diff --git a/dstatInterface/dstatInterface.xcodeproj/project.pbxproj b/dstatInterface/dstatInterface.xcodeproj/project.pbxproj
index 457e6659ec58203fe57e2e2f5e266c38ea10d73f..f49792526fce215d4d81a999ddd3bc504504aba8 100644
--- a/dstatInterface/dstatInterface.xcodeproj/project.pbxproj
+++ b/dstatInterface/dstatInterface.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXFileReference section */
+ 5FAED9CD1900FBDA00A9DDD4 /* dstatInterface.glade */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = dstatInterface.glade; sourceTree = ""; };
+ 5FAED9CE1900FE6B00A9DDD4 /* test2.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = test2.py; sourceTree = ""; };
5FDC0DFD18FDAD79003F857A /* main.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = main.py; sourceTree = ""; };
5FDC1E4218FF9572007AD04D /* glade1.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = glade1.py; sourceTree = ""; };
5FDC1E4318FF9A95007AD04D /* test1.glade */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = test1.glade; sourceTree = ""; };
@@ -16,9 +18,11 @@
5FDC0DF218FDACDA003F857A = {
isa = PBXGroup;
children = (
+ 5FAED9CE1900FE6B00A9DDD4 /* test2.py */,
+ 5FAED9CD1900FBDA00A9DDD4 /* dstatInterface.glade */,
5FDC1E4318FF9A95007AD04D /* test1.glade */,
- 5FDC1E4218FF9572007AD04D /* glade1.py */,
5FDC0DFD18FDAD79003F857A /* main.py */,
+ 5FDC1E4218FF9572007AD04D /* glade1.py */,
);
sourceTree = "";
};
diff --git a/dstatInterface/dstatInterface.xcodeproj/project.xcworkspace/xcuserdata/mdryden.xcuserdatad/UserInterfaceState.xcuserstate b/dstatInterface/dstatInterface.xcodeproj/project.xcworkspace/xcuserdata/mdryden.xcuserdatad/UserInterfaceState.xcuserstate
index 5731221d71119316c5583725e7466c79515969aa..fe0af0358b47f2512401f9914dc1138dfb5ba042 100644
Binary files a/dstatInterface/dstatInterface.xcodeproj/project.xcworkspace/xcuserdata/mdryden.xcuserdatad/UserInterfaceState.xcuserstate and b/dstatInterface/dstatInterface.xcodeproj/project.xcworkspace/xcuserdata/mdryden.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/dstatInterface/glade1.py b/dstatInterface/glade1.py
index 2200bb2480c504261f26ba82861c838a96d9fffc..454320aa4e21bda38289abc438a88655457d1c99 100644
--- a/dstatInterface/glade1.py
+++ b/dstatInterface/glade1.py
@@ -1,6 +1,21 @@
#!/usr/bin/env python
-import gtk
+import sys
+try:
+ import pygtk
+ pygtk.require('2.0')
+except:
+ pass
+try:
+ import gtk
+except:
+ print('GTK not available')
+ sys.exit(1)
+try:
+ import math
+except:
+ print('math lib missing')
+ sys.exit(1)
# we can call it just about anything we want
class Buglump:
@@ -23,6 +38,67 @@ class Buglump:
self.response = self.aboutdialog.run() #waits for user to click close - could test response with if
self.aboutdialog.hide()
+ def on_push_status_activate(self, menuitem, data=None): #adds message to top of stack
+ self.status_count += 1 #increment status_count
+ self.statusbar.push(self.context_id, "Message number %s" % str(self.status_count))
+
+ def on_pop_status_activate(self, menuitem, data=None): #removes top message from stack
+ self.status_count -= 1
+ self.statusbar.pop(self.context_id)
+
+ def on_clear_status_activate(self, menuitem, data=None): #clears status stack
+ self.statusbar.remove_all(self.context_id)
+ self.status_count = 0
+# while (self.status_count > 0):
+# self.statusbar.pop(self.context_id)
+# self.status_count -= 1
+
+ def on_sfm_button_clicked(self, button, data=None):
+ # create an instance of the entry objects
+ # so we can get and set the text values
+ self.entry1 = self.builder.get_object("entry1")
+ self.entry2 = self.builder.get_object("entry2")
+ self.result1 = self.builder.get_object("result1")
+
+ # get the text from the GtkEntry widget and convert
+ # it to a float value so we can calculate the result
+ self.sfm = float(self.entry1.get_text())
+ self.diameter = float(self.entry2.get_text())
+
+ # calculate the result convert to an int to round the number
+ # then convert to a string to set the text in our label
+ # notice the math.pi constant is used in the calculation
+ self.rpm = str(int(self.sfm * ((12/math.pi)/self.diameter)))
+
+ # debugging print
+ print "calculate rpm clicked"
+
+ # set the result label with our results
+ self.result1.set_text(self.rpm)
+
+ def on_gtk_new_activate(self, menuitem, data=None):
+ # debugging message
+ print 'File New selected'
+
+ # create a label for the tab and using get_n_pages() to find out how
+ # many pages there is so the next page has a sequential number.
+ self.label1 = gtk.Label('Page ' + str(self.notebook.get_n_pages() + 1))
+
+ # create a label to put into the page
+ self.label2 = gtk.Label('Hello World')
+ # If you don't show the contents of the tab it won't show up
+ self.label2.show()
+
+ # append a page with label5 as the contents and label5 as the tab
+ self.notebook.append_page(self.label2, self.label1)
+
+ def on_notebook1_switch_page(self, notebook, page, page_num, data=None):
+ self.tab = notebook.get_nth_page(page_num)
+ self.label = notebook.get_tab_label(self.tab).get_label()
+ self.message_id = self.statusbar.push(0, self.label)
+
+
+
# This is our init part where we connect the signals
def __init__(self):
self.gladefile = "test1.glade" # store the file name
@@ -34,12 +110,17 @@ class Buglump:
# you use this line to connect the signals.
self.builder.connect_signals(self)
- #get windows
+ #get widgets
self.window = self.builder.get_object("window1")
self.aboutdialog = self.builder.get_object("aboutdialog1")
+ self.statusbar = self.builder.get_object("statusbar")
+ self.notebook = self.builder.get_object("notebook1")
self.window.show() # this shows the 'window1' object
+ self.context_id = self.statusbar.get_context_id("status") #register and get statusbar context_id for description "status"
+ self.status_count = 0 #count of messages pushed
+
# If this is run stand alone execute the following after the 'if'
# If this class is imported into another program the code after the 'if' will
# not run. This makes the code more flexible.
diff --git a/dstatInterface/test1.glade b/dstatInterface/test1.glade
index 16afb80c1d497cc9cb609fcc9c3866f6b9f741fc..18fc7f55accd17bc06224d3ff567646ddae66545 100644
--- a/dstatInterface/test1.glade
+++ b/dstatInterface/test1.glade
@@ -34,6 +34,12 @@
+
+ True
+ False
+ 0.47999998927116394
+ gtk-missing-image
+
False
6
@@ -60,12 +66,13 @@
True
False
-
@@ -142,11 +149,44 @@
-
@@ -193,223 +233,67 @@
-
+
True
- False
+ True
+
-
+
True
- True
- never
- automatic
-
-
- True
- True
-
-
+ False
+ label
+
+
+
+
+ True
+ False
+ page 1
- True
- True
- 0
+ False
-
+
True
False
- 2
- True
- center
-
-
- gtk-goto-top
- True
- True
- True
- True
-
-
- False
- False
- 0
-
-
-
-
- gtk-go-up
- True
- True
- True
- True
-
-
- False
- False
- 1
-
-
-
-
- gtk-add
- True
- True
- True
- True
-
-
- False
- False
- 2
-
-
-
-
- gtk-remove
- True
- True
- True
- True
-
-
- False
- False
- 3
-
-
-
-
- gtk-go-down
- True
- True
- True
- True
-
-
- False
- False
- 4
-
-
-
-
- gtk-goto-bottom
- True
- True
- True
- True
-
-
- False
- False
- 5
-
-
+ label
- False
- True
1
+
+
+ True
+ False
+ page 2
+
+
+ 1
+ False
+
+
-
+
True
False
-
-
- True
- True
- automatic
- automatic
-
-
- True
- False
-
-
- True
- False
- 0
- 0
-
-
- True
- False
- 0
- in
-
-
- 300
- 200
- True
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- 0
-
-
-
-
- True
- False
- 2
- True
- center
-
-
- Show points
- True
- True
- False
- True
-
-
- False
- False
- 0
-
-
-
-
- Show lines
- True
- True
- False
- True
-
-
- False
- False
- 1
-
-
-
-
- False
- True
- 1
-
-
+ label
+
+
+ 2
+
+
+
+
+ True
+ False
+ page 3
- True
- True
2
+ False
@@ -420,7 +304,7 @@
-
+
True
False
2
diff --git a/dstatInterface/test2.py b/dstatInterface/test2.py
new file mode 100644
index 0000000000000000000000000000000000000000..558c52bcc764568ee97dff745685a56ff875f714
--- /dev/null
+++ b/dstatInterface/test2.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+
+import sys
+try:
+ import pygtk
+ pygtk.require('2.0')
+except:
+ pass
+try:
+ import gtk
+except:
+ print('GTK not available')
+ sys.exit(1)
+try:
+ import math
+except:
+ print('math lib missing')
+ sys.exit(1)
+
+# we can call it just about anything we want
+class Buglump:
+
+ # This first define is for our on_window1_destroy signal we created in the
+ # Glade designer. The print message does just that and prints to the terminal
+ # which can be useful for debugging. The 'object' if you remember is the signal
+ # class we picked from GtkObject.
+ def on_window1_destroy(self, object, data=None):
+ print "quit with cancel"
+ gtk.main_quit()
+
+ # This is the same as above but for our menu item.
+ def on_gtk_quit_activate(self, menuitem, data=None):
+ print "quit from menu"
+ gtk.main_quit()
+
+ def on_gtk_about_activate(self, menuitem, data=None):
+ print "help about selected"
+ self.response = self.aboutdialog.run() #waits for user to click close - could test response with if
+ self.aboutdialog.hide()
+
+ def on_push_status_activate(self, menuitem, data=None): #adds message to top of stack
+ self.status_count += 1 #increment status_count
+ self.statusbar.push(self.context_id, "Message number %s" % str(self.status_count))
+
+ def on_pop_status_activate(self, menuitem, data=None): #removes top message from stack
+ self.status_count -= 1
+ self.statusbar.pop(self.context_id)
+
+ def on_clear_status_activate(self, menuitem, data=None): #clears status stack
+ self.statusbar.remove_all(self.context_id)
+ self.status_count = 0
+ # while (self.status_count > 0):
+ # self.statusbar.pop(self.context_id)
+ # self.status_count -= 1
+
+ def on_expcombobox_changed(self, widget, data=None):
+ # get the index of the changed row
+ self.index = widget.get_active()
+
+ # get the model
+ self.model = widget.get_model()
+
+ # retrieve the item from column 1
+ self.item = self.model[self.index][1]
+
+ # debugging print statements
+ print "ComboBox Active Text is", self.item
+ print "ComboBox Active Index is", self.index
+
+ # This is our init part where we connect the signals
+ def __init__(self):
+ self.gladefile = "dstatInterface.glade" # store the file name
+ self.builder = gtk.Builder() # create an instance of the gtk.Builder
+ self.builder.add_from_file(self.gladefile) # add the xml file to the Builder
+
+ # This line does the magic of connecting the signals created in the Glade3
+ # builder to our defines above. You must have one def for each signal if
+ # you use this line to connect the signals.
+ self.builder.connect_signals(self)
+
+ #expcombobox
+ self.expcombobox = self.builder.get_object("expcombobox")
+ self.cell = gtk.CellRendererText()
+ self.expcombobox.pack_start(self.cell, True) #pack CellRenderer into beginning of combobox cell
+ self.expcombobox.add_attribute(self.cell, 'text', 1) # text in column 1
+ self.expcombobox.set_active(0) #set initial value
+
+
+
+ #get widgets
+ self.window = self.builder.get_object("window1")
+ self.aboutdialog = self.builder.get_object("aboutdialog1")
+ self.statusbar = self.builder.get_object("statusbar")
+
+
+ self.window.show() # this shows the 'window1' object
+
+ self.context_id = self.statusbar.get_context_id("status") #register and get statusbar context_id for description "status"
+ self.status_count = 0 #count of messages pushed
+
+# If this is run stand alone execute the following after the 'if'
+# If this class is imported into another program the code after the 'if' will
+# not run. This makes the code more flexible.
+if __name__ == "__main__":
+ main = Buglump() # create an instance of our class
+ gtk.main() # run the darn thing
\ No newline at end of file