Option tab spin buttons connected to key press events
This commit is contained in:
parent
192f3d88e5
commit
bf145c0715
|
@ -33,6 +33,7 @@
|
|||
#
|
||||
#
|
||||
|
||||
import gtk.gdk
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.ui.client import client
|
||||
|
@ -77,6 +78,12 @@ class OptionsTab(Tab):
|
|||
"on_move_completed_file_set": self._on_move_completed_file_set
|
||||
})
|
||||
|
||||
self.spin_max_download.connect("key-press-event", self._on_key_press_event)
|
||||
self.spin_max_upload.connect("key-press-event", self._on_key_press_event)
|
||||
self.spin_max_connections.connect("key-press-event", self._on_key_press_event)
|
||||
self.spin_max_upload_slots.connect("key-press-event", self._on_key_press_event)
|
||||
self.spin_stop_ratio.connect("key-press-event", self._on_key_press_event)
|
||||
|
||||
def start(self):
|
||||
if client.is_localhost():
|
||||
self.filechooser_move_completed.show()
|
||||
|
@ -294,6 +301,12 @@ class OptionsTab(Tab):
|
|||
if not self.button_apply.is_sensitive():
|
||||
self.button_apply.set_sensitive(True)
|
||||
|
||||
def _on_key_press_event(self, widget, event):
|
||||
keyname = gtk.gdk.keyval_name(event.keyval).lstrip("KP_").lower()
|
||||
if keyname.isdigit() or keyname in ["period", "minus", "delete", "backspace"]:
|
||||
if not self.button_apply.is_sensitive():
|
||||
self.button_apply.set_sensitive(True)
|
||||
|
||||
def _on_move_completed_file_set(self, widget):
|
||||
if not self.button_apply.is_sensitive():
|
||||
self.button_apply.set_sensitive(True)
|
||||
|
|
Loading…
Reference in New Issue