Started adding signals to the glade file.
This commit is contained in:
parent
b1241ab392
commit
81d685e845
2 changed files with 80 additions and 29 deletions
|
@ -8,6 +8,16 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-file</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="GearStockImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="GearsStockImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="GoToStockImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -19,14 +29,48 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<object class="GtkAction" id="connect_action">
|
||||
<property name="label" translatable="yes">Connect</property>
|
||||
<property name="short_label" translatable="yes">Connect</property>
|
||||
<property name="stock_id">gtk-connect</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_connect_action_activate" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="preferences_action">
|
||||
<property name="label" translatable="yes">Preferences</property>
|
||||
<property name="short_label" translatable="yes">Preferences</property>
|
||||
<property name="stock_id">gtk-preferences</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_preferences_action_activate" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="refresh_action">
|
||||
<property name="label" translatable="yes">Refresh</property>
|
||||
<property name="short_label" translatable="yes">Refresh</property>
|
||||
<property name="tooltip" translatable="yes">Refresh Docker containers and images list.</property>
|
||||
<property name="stock_id">gtk-refresh</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_refresh_action_activate" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="run_action">
|
||||
<property name="label" translatable="yes">Run</property>
|
||||
<property name="short_label" translatable="yes">Run</property>
|
||||
<property name="tooltip" translatable="yes">Run a new container based off an image.</property>
|
||||
<property name="stock_id">gtk-execute</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_run_action_activate" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="start_action">
|
||||
<property name="label" translatable="yes">Start</property>
|
||||
<property name="short_label" translatable="yes">Start</property>
|
||||
<property name="tooltip" translatable="yes">Start a selected stopped container.</property>
|
||||
<property name="stock_id">gtk-media-play</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="activate" handler="on_start_action_activate" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkWindow" id="MainWindow">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Stevedore</property>
|
||||
<signal name="delete-event" handler="on_MainWindow_delete_event" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox" id="MainBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -35,13 +79,14 @@
|
|||
<child>
|
||||
<object class="GtkToolbar" id="AppToolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="ToolConnect">
|
||||
<property name="related_action">connect_action</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Connect to the docker server</property>
|
||||
<property name="action_name">action_connect</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Connect</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-connect</property>
|
||||
|
@ -53,10 +98,10 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="Refresh">
|
||||
<property name="related_action">refresh_action</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Refresh the container and images list.</property>
|
||||
<property name="action_name">refresh_action</property>
|
||||
<property name="label" translatable="yes">Refresh</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-refresh</property>
|
||||
|
@ -78,9 +123,9 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="Preferences">
|
||||
<property name="related_action">preferences_action</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="action_name">preferences_action</property>
|
||||
<property name="label" translatable="yes">Preferences</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-preferences</property>
|
||||
|
@ -118,12 +163,14 @@
|
|||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="RunButton">
|
||||
<property name="label">gtk-execute</property>
|
||||
<property name="label">Run</property>
|
||||
<property name="use_action_appearance">True</property>
|
||||
<property name="related_action">run_action</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">run_action</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">GearsStockImage</property>
|
||||
<property name="yalign">0.55000001192092896</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
|
@ -136,6 +183,8 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="StartButton">
|
||||
<property name="label" translatable="yes">Start</property>
|
||||
<property name="use_action_appearance">True</property>
|
||||
<property name="related_action">start_action</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
|
@ -152,6 +201,8 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="StopButton">
|
||||
<property name="label">gtk-media-stop</property>
|
||||
<property name="use_action_appearance">True</property>
|
||||
<property name="related_action"/>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
|
@ -262,7 +313,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">build_action</property>
|
||||
<property name="image">image1</property>
|
||||
<property name="image">GearStockImage</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue