From 82d970defba9bfc0a7739c8970c9885015511077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas=20Albadalejo?= Date: Wed, 9 Jul 2014 15:02:33 +0200 Subject: [PATCH] Finished connecting and some boilerplate code for the gui --- res/stevedore.glade | 87 ++++++++++++++++++++++++++++----------------- src/stevedore.py | 75 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 33 deletions(-) diff --git a/res/stevedore.glade b/res/stevedore.glade index 1aae50f..0569780 100644 --- a/res/stevedore.glade +++ b/res/stevedore.glade @@ -13,11 +13,6 @@ False gtk-properties - - True - False - gtk-execute - True False @@ -29,6 +24,20 @@ False gtk-media-play + + Attach + Attach + gtk-jump-to + True + + + + Build + Build + gtk-properties + True + + Connect Connect @@ -36,6 +45,13 @@ True + + Log + Log + gtk-file + True + + Preferences Preferences @@ -51,13 +67,19 @@ True - + + Remove + Remove + gtk-delete + True + + + Run Run - Run a new container based off an image. gtk-execute True - + Start @@ -67,6 +89,13 @@ True + + Stop + Stop + gtk-media-stop + True + + False Stevedore @@ -161,25 +190,6 @@ True False 5 - - - Run - True - run_action - True - True - True - run_action - GearsStockImage - 0.55000001192092896 - True - - - False - True - 0 - - Start @@ -195,14 +205,14 @@ False True - 1 + 0 gtk-media-stop True - + stop_action True True True @@ -213,12 +223,14 @@ False True - 2 + 1 Attach + True + attach_action True True True @@ -229,12 +241,14 @@ False True - 3 + 2 Log + True + log_action True True True @@ -245,7 +259,7 @@ False True - 4 + 3 @@ -309,11 +323,14 @@ Build + True + build_action True True True build_action GearStockImage + 0.61000001430511475 True @@ -325,6 +342,8 @@ gtk-delete + True + remove_image_action True True True @@ -339,8 +358,10 @@ - + gtk-execute + True + runimage_action True True True diff --git a/src/stevedore.py b/src/stevedore.py index 9d3cca5..4206a70 100644 --- a/src/stevedore.py +++ b/src/stevedore.py @@ -47,10 +47,21 @@ class MainWindow(Gtk.Application): self.add_window(self.window) self.window.show() + def refresh_views(self): + """ + Refresh the docker interface object and the reload the ListViews + to get a fresh snapshot of the system + """ + print "Not Implemented: refresh_views" + + # Events and "natural" callbacks + def on_MainWindow_delete_event(self, obj, event = None): "on_MainWindow_delete_event activated" print 'on_MainWindow_delete_event activated' + # Action callbacks + def on_connect_action_activate(self, obj, event = None): """ Connection action has been triggered @@ -65,6 +76,70 @@ class MainWindow(Gtk.Application): print u"Error connecting to Docker Server: " + unicode(e) self.docker = None + def on_preferences_action_activate(self, obj, event = None): + """ + We've been asked for the preferences window + """ + # TODO + print "Not implemented: on_preferences_action_activate" + + def on_refresh_action_activate(self, obj, event = None): + """ + The user wants to reload the listings + """ + print "on_refresh_action_activate" + self.refresh_views() + + def on_start_action_activate(self, obj, event = None): + """ + The user demands a certain container to be started + """ + print "Not implemented: on_start_action_activate" + + def on_stop_action_activate(self, obj, event = None): + """ + The user wants to stop a certain container + """ + # TODO: Remember to show a warning and a yes-no choice before proceeding! + print "Not implemented: on_stop_action_activate" + + def on_attach_action_activate(self, obj, event = None): + """ + Here we're requested to attach to a running container + """ + # TODO: We should launch $TERM with the attach command + # if the container is running. If not, we display an error or warning + # Maybe offer the option to start it and then attach? + print "Not implemented: on_attach_action_activate" + + def on_log_action_activate(self, obj, event = None): + """ + User wants to see the log output of a certain container + """ + # TODO: We should launch $TERM with the log command and the -f option + # unless it is not running, where we remove the -f option and launch it + # anyway. + print "Not implemented: on_log_action_activate" + + def on_build_action_activate(self, obj, event = None): + """ + Command for building new images from Dockerfiles + """ + # TODO: Open a OpenFileDialog and build the image. + print "Not implemented: on_build_action_activate" + + def on_remove_image_action_activate(self, obj, event = None): + """ + We've been asked to remove an existing image + """ + print "Not implemented: on_remove_image_action_activate" + + def on_runimage_action_activate(self, obj, event = None): + """ + Launch selected image into a running container + """ + print "Not implemented: on_runimage_action_activate" + # run main loop def main():