aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2016-01-05 19:38:42 +0100
committerMaZderMind <github@mazdermind.de>2016-01-05 19:38:42 +0100
commit50739c687d9252ab7d5c851bf32a1fd056f6544d (patch)
treef78ce7073d900b67f00f29e44eae0eb2148aa570
parente2969b87441a46fe0c017f1f29bb7ec3f4fce585 (diff)
add cut-button and a cutlist-script and make both configurable
-rwxr-xr-xexample-scripts/control-server/generate-cut-list.py19
-rw-r--r--voctogui/default-config.ini4
-rw-r--r--voctogui/lib/toolbar/misc.py12
-rw-r--r--voctogui/ui/voctogui.ui15
4 files changed, 48 insertions, 2 deletions
diff --git a/example-scripts/control-server/generate-cut-list.py b/example-scripts/control-server/generate-cut-list.py
new file mode 100755
index 0000000..305ef83
--- /dev/null
+++ b/example-scripts/control-server/generate-cut-list.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python3
+import socket
+import datetime
+
+host = 'localhost'
+port = 9999
+
+conn = socket.create_connection( (host, port) )
+fd = conn.makefile('rw')
+
+for line in fd:
+ words = line.rstrip('\n').split(' ')
+
+ signal = words[0]
+ args = words[1:]
+
+ if signal == 'message' and args[0] == 'cut':
+ ts = datetime.datetime.now().strftime("%Y-%m-%d/%H_%M_%S")
+ print(ts)
diff --git a/voctogui/default-config.ini b/voctogui/default-config.ini
index cfb7ae0..cfc422f 100644
--- a/voctogui/default-config.ini
+++ b/voctogui/default-config.ini
@@ -21,3 +21,7 @@ system=gl
# Use simple X-Images - least performant
#system=x
+
+[misc]
+close=true
+cut=true
diff --git a/voctogui/lib/toolbar/misc.py b/voctogui/lib/toolbar/misc.py
index 91ccf79..32dd96c 100644
--- a/voctogui/lib/toolbar/misc.py
+++ b/voctogui/lib/toolbar/misc.py
@@ -11,9 +11,17 @@ class MiscToolbarController(object):
self.log = logging.getLogger('MiscToolbarController')
closebtn = uibuilder.find_widget_recursive(drawing_area, 'close')
+ closebtn.set_visible( Config.getboolean('misc', 'close') )
+ closebtn.connect('clicked', self.on_closebtn_clicked)
- closebtn.connect('clicked', self.on_btn_clicked)
+ cutbtn = uibuilder.find_widget_recursive(drawing_area, 'cut')
+ cutbtn.set_visible( Config.getboolean('misc', 'cut') )
+ cutbtn.connect('clicked', self.on_cutbtn_clicked)
- def on_btn_clicked(self, btn):
+ def on_closebtn_clicked(self, btn):
self.log.info('close-button clicked')
Gtk.main_quit()
+
+ def on_cutbtn_clicked(self, btn):
+ self.log.info('cut-button clicked')
+ Connection.send('message', 'cut')
diff --git a/voctogui/ui/voctogui.ui b/voctogui/ui/voctogui.ui
index 25bd711..fe04601 100644
--- a/voctogui/ui/voctogui.ui
+++ b/voctogui/ui/voctogui.ui
@@ -157,6 +157,21 @@
<property name="label" translatable="yes">Close</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-close</property>
+ <property name="no_show_all">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="cut">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Cut</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-cut</property>
+ <property name="no_show_all">True</property>
</object>
<packing>
<property name="expand">False</property>