Fix up the Label plugin's GTK dialogs to be more consistent

This commit is contained in:
Andrew Resch 2008-11-21 10:11:36 +00:00
parent dc63d26cfe
commit 9e174166b8
2 changed files with 276 additions and 154 deletions

View File

@ -1,17 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Wed Aug 13 22:04:09 2008 -->
<!--Generated with glade3 3.4.5 on Fri Nov 21 02:05:43 2008 -->
<glade-interface>
<widget class="GtkDialog" id="dlg_label_options">
<property name="border_width">5</property>
<property name="title" translatable="yes">Label Options</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="skip_taskbar_hint">True</property>
<property name="decorated">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">2</property>
<property name="spacing">5</property>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label_header">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Label Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkNotebook" id="notebook2">
<property name="visible">True</property>
@ -19,6 +63,7 @@
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="border_width">2</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@ -54,41 +99,103 @@
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="label14">
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="max_connections">
<widget class="GtkSpinButton" id="max_upload_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">-1 -1 9999 1 10 10</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<widget class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Connections:</property>
<property name="label" translatable="yes">KiB/s</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="max_download_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">-1 -1 9999 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Slots: </property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Speed:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Download Speed:</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">KiB/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -110,105 +217,43 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Kib/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Download Speed:</property>
<property name="use_markup">True</property>
<property name="label" translatable="yes">Connections:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Speed:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Slots: </property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="max_download_speed">
<widget class="GtkSpinButton" id="max_connections">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">-1 -1 9999 1 10 10</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label24">
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">Kib/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="max_upload_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">-1 -1 9999 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="y_options">GTK_FILL</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
@ -242,6 +287,7 @@
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="border_width">2</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@ -269,29 +315,42 @@
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="label13">
<widget class="GtkLabel" id="label16">
<property name="visible">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="stop_ratio">
<widget class="GtkCheckButton" id="is_auto_managed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">2 1 100 1 10 10</property>
<property name="digits">2</property>
<property name="label" translatable="yes">Auto Managed</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="stop_at_ratio">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Stop seed at ratio:</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -311,43 +370,30 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="stop_at_ratio">
<widget class="GtkSpinButton" id="stop_ratio">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Stop seed at ratio:</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<property name="adjustment">2 1 100 1 10 10</property>
<property name="digits">2</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="x_options"></property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="is_auto_managed">
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Auto Managed</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label16">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
@ -385,6 +431,7 @@
<child>
<widget class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="border_width">2</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@ -397,13 +444,15 @@
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label9">
<widget class="GtkFileChooserButton" id="move_completed_path">
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
@ -421,15 +470,13 @@
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="move_completed_path">
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
</widget>
@ -467,6 +514,7 @@
<child>
<widget class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="border_width">2</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
@ -477,13 +525,22 @@
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<child>
<widget class="GtkTextView" id="auto_add_trackers">
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">tracker1.org
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkTextView" id="auto_add_trackers">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">tracker1.org
tracker2.com
this doesn't do anything yet..
</property>
</widget>
</child>
</widget>
</child>
<child>
@ -532,7 +589,7 @@ this doesn't do anything yet..
</child>
</widget>
<packing>
<property name="position">1</property>
<property name="position">3</property>
</packing>
</child>
<child internal-child="action_area">
@ -544,7 +601,7 @@ this doesn't do anything yet..
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="no">gtk-cancel</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_options_cancel"/>
@ -555,7 +612,7 @@ this doesn't do anything yet..
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="no">gtk-ok</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_options_ok"/>
@ -576,8 +633,11 @@ this doesn't do anything yet..
<widget class="GtkDialog" id="dlg_label_add">
<property name="border_width">5</property>
<property name="title" translatable="yes">Add Label</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="skip_taskbar_hint">True</property>
<property name="decorated">False</property>
<property name="has_separator">False</property>
<signal name="close" handler="on_label_cancel"/>
<child internal-child="vbox">
@ -587,24 +647,78 @@ this doesn't do anything yet..
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label12">
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Label name:&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
</child>
<child>
<widget class="GtkEntry" id="txt_add">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Add Label&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator2">
<property name="visible">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="label" translatable="yes">Name:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_add">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
@ -620,7 +734,7 @@ this doesn't do anything yet..
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="no">gtk-cancel</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_add_cancel"/>
@ -630,8 +744,10 @@ this doesn't do anything yet..
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="no">gtk-ok</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_add_ok"/>

View File

@ -92,7 +92,7 @@ class LabelSidebarMenu(object):
aclient.label_remove(None, self.treeview.value)
def on_options (self, event=None):
self.options_dialog.show(self.treeview.value, (200,250))
self.options_dialog.show(self.treeview.value)
def on_show(self, widget=None, data=None):
"No Label:disable options/del"
@ -135,6 +135,8 @@ class AddDialog(object):
def show(self):
self.glade = gtk.glade.XML(get_resource("label_options.glade"))
self.dialog = self.glade.get_widget("dlg_label_add")
self.dialog.set_transient_for(component.get("MainWindow").window)
self.glade.signal_autoconnect({
"on_add_ok":self.on_ok,
"on_add_cancel":self.on_cancel,
@ -168,21 +170,25 @@ class OptionsDialog(object):
def __init__(self):
pass
def show(self, label , position):
def show(self, label):
self.label = label
self.glade = gtk.glade.XML(get_resource("label_options.glade"))
self.dialog = self.glade.get_widget("dlg_label_options")
self.dialog.set_transient_for(component.get("MainWindow").window)
self.glade.signal_autoconnect({
"on_options_ok":self.on_ok,
"on_options_cancel":self.on_cancel,
})
# Show the label name in the header label
self.glade.get_widget("label_header").set_markup("<b>Label Options:</b> %s" % self.label)
for chk_id, group in self.sensitive_groups:
chk = self.glade.get_widget(chk_id)
chk.connect("toggled",self.apply_sensitivity)
aclient.label_get_options(self.load_options, self.label)
self.dialog.move(*position)
self.dialog.run()
def load_options(self, options):