dialogs/windows modality fix

This commit is contained in:
Marcos Pinto 2007-08-05 20:13:24 +00:00
parent 9024c5b620
commit ef1296cc36
11 changed files with 808 additions and 768 deletions

View File

@ -9,7 +9,7 @@
<property name="default_width">583</property>
<property name="default_height">431</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<child internal-child="vbox">
@ -127,6 +127,7 @@
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="pressed" handler="on_close_pressed"/>
</widget>
</child>
</widget>

View File

@ -10,7 +10,7 @@
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_height">550</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="has_separator">False</property>
@ -2289,7 +2289,7 @@ HTTP W/ Auth</property>
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button2">
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
@ -2297,7 +2297,7 @@ HTTP W/ Auth</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<widget class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>

View File

@ -71,8 +71,11 @@ class EventLogging:
self.dialog_initialize = True
self.glade = gtk.glade.XML(path + "/event_logging_preferences.glade")
self.dialog = self.glade.get_widget("dialog")
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.glade.signal_autoconnect({
'toggle_ui': self.toggle_ui
'toggle_ui': self.toggle_ui,
'on_button_cancel_pressed': self.cancel_pressed,
'on_button_ok_pressed': self.ok_pressed
})
self.viewport = gtk.Viewport()
self.scrolledWindow = gtk.ScrolledWindow()
@ -341,9 +344,9 @@ class EventLogging:
self.glade.get_widget("chk_log_files").set_active(False)
self.dialog_initialize = False
self.dialog.show()
response = self.dialog.run()
def ok_pressed(self, src):
self.dialog.hide()
if response:
self.config.set("enable_finished", self.glade.get_widget("chk_finished").get_active())
self.config.set("enable_peer_error", self.glade.get_widget("chk_peer_error").get_active())
self.config.set("enable_invalid_request", self.glade.get_widget("chk_invalid_request").get_active())
@ -362,3 +365,6 @@ class EventLogging:
self.config.set("enable_peer_blocked", self.glade.get_widget("chk_peer_blocked").get_active())
self.config.set("enable_other", self.glade.get_widget("chk_other").get_active())
self.config.set("enable_log_files", self.glade.get_widget("chk_log_files").get_active())
def cancel_pressed(self, src):
self.dialog.hide()

View File

@ -7,6 +7,7 @@
<property name="title" translatable="yes">Event Logging Preferences</property>
<property name="default_width">400</property>
<property name="default_height">150</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@ -18,249 +19,28 @@
<property name="visible">True</property>
<property name="n_rows">20</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Select events to log</property>
</widget>
</child>
<child>
<widget class="GtkCheckButton" id="chk_finished">
<widget class="GtkCheckButton" id="chk_log_files">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Torrent finished</property>
<property name="label" translatable="yes">Enable log files</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">19</property>
<property name="bottom_attach">20</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_peer_error">
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Peer messages</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
<property name="label" translatable="yes">Log files</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_invalid_request">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Invalid request</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_file_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">File error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_hash_failed_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Hash failed error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_peer_ban_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Peer ban error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_fastresume_rejected_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Fastresume rejected error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_announce">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker announce</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_reply">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker reply</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_alert">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker alert</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_warning">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker warning</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_storage_moved">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Storage moved</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_piece_finished">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Piece finished</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_block_downloading">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Block downloading</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_block_finished">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Block finished</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_peer_blocked">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Peer blocked</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
</packing>
</child>
<child>
@ -279,34 +59,256 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Log files</property>
</widget>
<packing>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_log_files">
<widget class="GtkCheckButton" id="chk_peer_blocked">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable log files</property>
<property name="label" translatable="yes">Peer blocked</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">19</property>
<property name="bottom_attach">20</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_block_finished">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Block finished</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_block_downloading">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Block downloading</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_piece_finished">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Piece finished</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_storage_moved">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Storage moved</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_warning">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker warning</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_alert">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker alert</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_reply">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker reply</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tracker_announce">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Tracker announce</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_fastresume_rejected_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Fastresume rejected error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_peer_ban_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Peer ban error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_hash_failed_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Hash failed error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_file_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">File error</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_invalid_request">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Invalid request</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_peer_error">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Peer messages</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_finished">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Torrent finished</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Select events to log</property>
</widget>
</child>
</widget>
<packing>
<property name="fill">False</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
@ -320,6 +322,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="pressed" handler="on_button_cancel_pressed"/>
</widget>
</child>
<child>
@ -328,6 +331,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
<signal name="pressed" handler="on_button_ok_pressed"/>
</widget>
<packing>
<property name="position">1</property>
@ -343,4 +347,3 @@
</child>
</widget>
</glade-interface>

View File

@ -28,6 +28,7 @@ class plugin_RSS:
#set up the preferences dialog
glade = gtk.glade.XML(path + "/rss.glade")
self.dlg = glade.get_widget("dialog")
self.dlg.set_position(gtk.WIN_POS_CENTER)
self.dlg.set_icon_from_file(self.path + "/rss.png")
#set up the feeds list viewer
self.feeds_view = glade.get_widget("feeds_view")
@ -87,7 +88,9 @@ class plugin_RSS:
"feedchoice_combo_changed" : self.feedchoice_combo_changed,
"torrents_fcc_changed" : self.torrents_fcc_changed,
"torrents_view_row_activated" : self.torrents_view_row_activated,
"chkfeeds_clicked" : self.chkfeeds_clicked }
"chkfeeds_clicked" : self.chkfeeds_clicked,
"cancel_pressed" : self.dialog_cancel,
"ok_pressed" : self.dialog_ok }
glade.signal_autoconnect(dic)
self.feeds_view.get_selection().set_select_function(self.row_clicked)
self.timer = 0
@ -415,9 +418,9 @@ class plugin_RSS:
self.button_delfilter.set_sensitive(0)
self.update_entry.set_text(str(self.interval))
self.checkonstart_button.set_active(self.checkonstart)
result = self.dlg.run()
def dialog_ok(self, source):
self.dlg.hide_all()
if result == 1:
self.interval = int(self.update_entry.get_text())
self.feeds_config.set("DEFAULT", "interval", self.update_entry.get_text())
self.feeds_config.set("DEFAULT", "checkonstart", self.checkonstart_button.get_active())
@ -428,10 +431,14 @@ class plugin_RSS:
self.feeds_config.write(f)
f.close()
def dialog_cancel(self, source):
self.dlg.hide_all()
def update(self):
self.timer += 1
if self.timer >= self.interval:
import threading
print "BONG!"
self.checkfeeds()
threading.Thread(target=self.checkfeeds).start
self.timer = 0

View File

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.2 on Sun Jul 15 13:48:13 2007 by markybob@peg-->
<!--Generated with glade3 3.3.3 on Sun Aug 5 10:26:04 2007 -->
<glade-interface>
<widget class="GtkDialog" id="dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">RSS Broadcatcher Settings</property>
<property name="default_width">512</property>
<property name="default_height">384</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@ -857,6 +858,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="pressed" handler="cancel_pressed"/>
</widget>
</child>
<child>
@ -865,6 +867,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
<signal name="pressed" handler="ok_pressed"/>
</widget>
<packing>
<property name="position">1</property>

View File

@ -55,8 +55,11 @@ class TorrentNotification:
self.glade = gtk.glade.XML(path + "/notification_preferences.glade")
self.dialog = self.glade.get_widget("dialog")
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.glade.signal_autoconnect({
'toggle_ui': self.toggle_ui
'toggle_ui': self.toggle_ui,
'dialog_ok': self.dialog_ok,
'dialog_cancel': self.dialog_cancel
})
def handle_event(self, event):
@ -111,14 +114,17 @@ class TorrentNotification:
self.glade.get_widget("sound_path_button").set_filename(os.path.expanduser("~/"))
self.glade.get_widget("sound_path_button").set_sensitive(False)
self.dialog.show()
response = self.dialog.run()
def dialog_ok(self, source):
self.dialog.hide()
if response:
self.config.set("enable_tray_blink", self.glade.get_widget("chk_tray_blink").get_active())
self.config.set("enable_notification", self.glade.get_widget("chk_notification").get_active())
self.config.set("enable_sound", self.glade.get_widget("chk_sound").get_active())
self.config.set("sound_path", self.glade.get_widget("sound_path_button").get_filename())
def dialog_cancel(self, source):
self.dialog.hide()
def toggle_ui(self, widget):
value = widget.get_active()
if widget == self.glade.get_widget("chk_sound"):

View File

@ -7,6 +7,7 @@
<property name="title" translatable="yes">Torrent Notification Preferences</property>
<property name="default_width">400</property>
<property name="default_height">150</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@ -33,8 +34,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FILE</property>
<property name="title" translatable="yes">Select A File</property>
</widget>
<packing>
<property name="position">1</property>
@ -42,24 +41,15 @@
</child>
</widget>
<packing>
<property name="fill">False</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<child>
<widget class="GtkCheckButton" id="chk_tray_blink">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable blinking tray icon</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
</child>
<child>
<widget class="GtkCheckButton" id="chk_notification">
<property name="visible">True</property>
@ -74,10 +64,21 @@
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_tray_blink">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable blinking tray icon</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="fill">False</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
@ -91,6 +92,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="pressed" handler="dialog_cancel"/>
</widget>
</child>
<child>
@ -99,6 +101,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
<signal name="pressed" handler="dialog_ok"/>
</widget>
<packing>
<property name="position">1</property>
@ -114,4 +117,3 @@
</child>
</widget>
</glade-interface>

View File

@ -43,6 +43,7 @@ class PreferencesDlg:
def __init__(self, preferences, active_port):
self.glade = gtk.glade.XML(common.get_glade_file("preferences_dialog.glade"), domain='deluge')
self.dialog = self.glade.get_widget("pref_dialog")
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
self.glade.signal_autoconnect({
'toggle_ui': self.toggle_ui,
@ -52,7 +53,7 @@ class PreferencesDlg:
self.preferences = preferences
self.active_port = str(active_port)
def show(self):
def show(self, interface):
# Load settings into dialog
try:
self.glade.get_widget("combo_encin").set_active(self.preferences.get("encin_state"))
@ -139,14 +140,16 @@ class PreferencesDlg:
self.glade.get_widget('spin_port_min').set_sensitive(True)
self.glade.get_widget('spin_port_max').set_sensitive(True)
self.glade.get_widget("ok_button").connect("pressed", self.ok_pressed, interface)
self.glade.get_widget("cancel_button").connect("pressed", self.cancel_pressed)
except KeyError:
pass
# Now, show the dialog
self.dialog.show()
r = self.dialog.run()
def ok_pressed(self, source, interface):
self.dialog.hide()
# Now, get the settings from the dialog
if r == 1:
self.preferences.set("encin_state", self.glade.get_widget("combo_encin").get_active())
self.preferences.set("encout_state", self.glade.get_widget("combo_encout").get_active())
self.preferences.set("enclevel_type", self.glade.get_widget("combo_enclevel").get_active())
@ -205,7 +208,11 @@ class PreferencesDlg:
self.preferences.set("clear_max_ratio_torrents", self.glade.get_widget("chk_clear_max_ratio_torrents").get_active())
self.preferences.set("queue_above_completed", self.glade.get_widget("chk_queue_above_completed").get_active())
return r
interface.apply_prefs()
interface.config.save()
def cancel_pressed(self, source):
self.dialog.hide()
def TestPort(self, widget):
common.open_url_in_browser('http://www.deluge-torrent.org/test-port.php?port=%s' % self.active_port)
@ -268,6 +275,7 @@ class MergeDlg:
self.glade = gtk.glade.XML(common.get_glade_file("merge_dialog.glade"),
domain='deluge')
self.dialog = self.glade.get_widget("merge_dialog")
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
def show(self):
@ -282,6 +290,7 @@ class FilesDlg:
self.glade = gtk.glade.XML(common.get_glade_file("files_dialog.glade"),
domain='deluge')
self.dialog = self.glade.get_widget("file_dialog")
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
self.files_manager = files.FilesDialogManager(
@ -310,6 +319,7 @@ class PluginDlg:
def __init__(self, plugins):
self.glade = gtk.glade.XML(common.get_glade_file("plugin_dialog.glade"), domain='deluge')
self.dialog = self.glade.get_widget("plugin_dialog")
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png"))
self.view = self.glade.get_widget("plugin_view")
self.store = gtk.ListStore(str, bool)
@ -322,7 +332,9 @@ class PluginDlg:
name_col = dgtk.add_text_column(self.view, _("Plugin"), 0)
name_col.set_expand(True)
dgtk.add_toggle_column(self.view, _("Enabled"), 1, toggled_signal=self.plugin_toggled)
self.glade.signal_autoconnect({'plugin_pref': self.plugin_pref})
signals = {'plugin_pref': self.plugin_pref,
'on_close_pressed': self.close_pressed}
self.glade.signal_autoconnect(signals)
self.plugins = plugins
def show(self):
@ -336,7 +348,8 @@ class PluginDlg:
self.glade.get_widget("plugin_text").get_buffer().set_text("")
self.glade.get_widget("plugin_conf").set_sensitive(False)
self.dialog.show()
self.dialog.run()
def close_pressed(self, source):
self.dialog.hide()
def old_clicked(self, path):
@ -385,6 +398,7 @@ def show_about_dialog(parent=None):
gtk.about_dialog_set_url_hook(url_hook)
abt = gtk.glade.XML(common.get_glade_file("aboutdialog.glade")).get_widget("aboutdialog")
abt.set_position(gtk.WIN_POS_CENTER)
abt.set_name(common.PROGRAM_NAME)
abt.set_version(common.PROGRAM_VERSION)
abt.set_authors(["Zach Tibbitts", "Alon Zakai", "Marcos Pinto", "Andrew Resch", "Alex Dedul"])

View File

@ -639,9 +639,7 @@ class DelugeGTK:
active_port = self.manager.get_state()['port']
preferences_dialog = dialogs.PreferencesDlg(self.config, active_port)
# Only apply the prefs if the user pressed OK in the prefs dialog
if preferences_dialog.show() == 1:
self.apply_prefs()
self.config.save()
preferences_dialog.show(self)
def show_preferences_dialog_clicked(self, arg=None):
if self.config.get("lock_tray") == True:

View File

@ -11,7 +11,7 @@ if new_release > sys.argv[1]:
dialog = gtk.MessageDialog(parent = None,
flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons = gtk.BUTTONS_YES_NO,
message_format="There is a newer version of Deluge. Would you like to be taken to our download site?",
message_format=_("There is a newer version of Deluge. Would you like to be taken to our download site?"),
type=gtk.MESSAGE_QUESTION)
dialog.set_title('New Release!')
import time