add 'edit' tracker to edit trackers dialog

This commit is contained in:
Marcos Pinto 2008-08-14 01:11:54 +00:00
parent 1aa727db3d
commit bc64bed102
3 changed files with 196 additions and 4 deletions

View File

@ -6,3 +6,4 @@ Deluge 1.1.0 - "" (In Development)
GtkUI:
* Add peer progress to the peers tab
* Add 'edit' to edit trackers dialog

View File

@ -50,6 +50,8 @@ class EditTrackersDialog:
self.treeview = self.glade.get_widget("tracker_treeview")
self.add_tracker_dialog = self.glade.get_widget("add_tracker_dialog")
self.add_tracker_dialog.set_transient_for(self.dialog)
self.edit_tracker_entry = self.glade.get_widget("edit_tracker_entry")
self.edit_tracker_entry.set_transient_for(self.dialog)
self.dialog.set_icon(deluge.common.get_logo(32))
@ -60,6 +62,9 @@ class EditTrackersDialog:
self.glade.signal_autoconnect({
"on_button_up_clicked": self.on_button_up_clicked,
"on_button_add_clicked": self.on_button_add_clicked,
"on_button_edit_clicked": self.on_button_edit_clicked,
"on_button_edit_cancel_clicked": self.on_button_edit_cancel_clicked,
"on_button_edit_ok_clicked": self.on_button_edit_ok_clicked,
"on_button_remove_clicked": self.on_button_remove_clicked,
"on_button_down_clicked": self.on_button_down_clicked,
"on_button_ok_clicked": self.on_button_ok_clicked,
@ -127,7 +132,28 @@ class EditTrackersDialog:
selected = self.get_selected()
if selected != None:
self.liststore.remove(selected)
def on_button_edit_clicked(self, widget):
"""edits an existing tracker"""
log.debug("on_button_edit_clicked")
selected = self.get_selected()
if selected:
tracker = self.liststore.get_value(selected, 1)
self.glade.get_widget("entry_edit_tracker").set_text(tracker)
self.edit_tracker_entry.show()
self.glade.get_widget("edit_tracker_entry").grab_focus()
def on_button_edit_cancel_clicked(self, widget):
log.debug("on_button_edit_cancel_clicked")
self.edit_tracker_entry.hide()
def on_button_edit_ok_clicked(self, widget):
log.debug("on_button_edit_ok_clicked")
selected = self.get_selected()
tracker = self.glade.get_widget("entry_edit_tracker").get_text()
self.liststore.set_value(selected, 1, tracker)
self.edit_tracker_entry.hide()
def on_button_down_clicked(self, widget):
log.debug("on_button_down_clicked")
selected = self.get_selected()

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.0 on Mon Nov 12 03:27:39 2007 -->
<!--Generated with glade3 3.4.5 on Wed Aug 13 20:02:28 2008 -->
<glade-interface>
<widget class="GtkDialog" id="edit_trackers_dialog">
<property name="width_request">400</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Edit Trackers</property>
@ -113,6 +114,20 @@
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_exit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-edit</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_edit_clicked"/>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_remove">
<property name="visible">True</property>
@ -125,7 +140,7 @@
<signal name="clicked" handler="on_button_remove_clicked"/>
</widget>
<packing>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -140,7 +155,7 @@
<signal name="clicked" handler="on_button_down_clicked"/>
</widget>
<packing>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
</widget>
@ -202,6 +217,7 @@
</child>
</widget>
<widget class="GtkDialog" id="add_tracker_dialog">
<property name="width_request">400</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Add Tracker</property>
@ -349,4 +365,153 @@
</widget>
</child>
</widget>
<widget class="GtkDialog" id="edit_tracker_entry">
<property name="width_request">400</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Edit Tracker</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="decorated">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">2</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">5</property>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">5</property>
<child>
<widget class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-edit</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">&lt;b&gt;Edit Tracker&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>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Tracker:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry_edit_tracker">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</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>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button_add_cancel1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_edit_cancel_clicked"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button_add_ok1">
<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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_edit_ok_clicked"/>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>