diff --git a/res/stevedore.glade b/res/stevedore.glade index 3068097..1aae50f 100644 --- a/res/stevedore.glade +++ b/res/stevedore.glade @@ -8,6 +8,16 @@ False gtk-file + + True + False + gtk-properties + + + True + False + gtk-execute + True False @@ -19,14 +29,48 @@ False gtk-media-play - - True - False - gtk-properties + + Connect + Connect + gtk-connect + True + + + + Preferences + Preferences + gtk-preferences + True + + + + Refresh + Refresh + Refresh Docker containers and images list. + gtk-refresh + True + + + + Run + Run + Run a new container based off an image. + gtk-execute + True + + + + Start + Start + Start a selected stopped container. + gtk-media-play + True + False Stevedore + True @@ -35,13 +79,14 @@ True - False + True + connect_action True - False + True Connect to the docker server - action_connect + start Connect True gtk-connect @@ -53,10 +98,10 @@ + refresh_action True False Refresh the container and images list. - refresh_action Refresh True gtk-refresh @@ -78,9 +123,9 @@ + preferences_action True False - preferences_action Preferences True gtk-preferences @@ -118,12 +163,14 @@ 5 - gtk-execute + Run + True + run_action True True True run_action - True + GearsStockImage 0.55000001192092896 True @@ -136,6 +183,8 @@ Start + True + start_action True True True @@ -152,6 +201,8 @@ gtk-media-stop + True + True True True @@ -262,7 +313,7 @@ True True build_action - image1 + GearStockImage True diff --git a/src/stevedore.py b/src/stevedore.py index 38ed2e7..9d3cca5 100644 --- a/src/stevedore.py +++ b/src/stevedore.py @@ -20,6 +20,7 @@ from gi.repository import Gtk, Gio from pkg_resources import resource_string +from docker_iface import DockerInterface, DockerImage, DockerContainer class MainWindow(Gtk.Application): @@ -41,29 +42,28 @@ class MainWindow(Gtk.Application): # connect handlers self.builder.connect_signals(self) - # widgets + # Add window to the App and show it self.window = self.builder.get_object('MainWindow') self.add_window(self.window) self.window.show() - # Remember to add your Gtk.Window to the object with self.add_window(my_gtk_window) + def on_MainWindow_delete_event(self, obj, event = None): + "on_MainWindow_delete_event activated" + print 'on_MainWindow_delete_event activated' - # signal handlers - # def on_action_save_activate(self, obj, event = None): - # "on_action_save_activate activated" - # print 'on_action_save_activate activated' + def on_connect_action_activate(self, obj, event = None): + """ + Connection action has been triggered + """ + # TODO: Get the parameters from configuration + try: + self.docker = DockerInterface() + self.refresh_views() - # def on_action_record_activate(self, obj, event = None): - # "on_action_record_activate activated" - # print 'on_action_record_activate activated' - - # def on_MainWindow_delete_event(self, obj, event = None): - # "on_MainWindow_delete_event activated" - # print 'on_MainWindow_delete_event activated' - - # def on_SaveWindow_delete_event(self, obj, event = None): - # "on_SaveWindow_delete_event activated" - # print 'on_SaveWindow_delete_event activated' + except Exception as e: + # FIXME: Show a nicer message with a MessageBox + print u"Error connecting to Docker Server: " + unicode(e) + self.docker = None # run main loop