add custom option for file manager

This commit is contained in:
Marcos Pinto 2007-08-08 23:03:44 +00:00
parent fa505b6750
commit 95d5e33301
4 changed files with 90 additions and 18 deletions

View File

@ -2261,28 +2261,82 @@ HTTP W/ Auth</property>
<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>
<child>
<widget class="GtkHBox" id="hbox13">
<widget class="GtkTable" id="table6">
<property name="visible">True</property>
<property name="spacing">15</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label39">
<widget class="GtkAlignment" id="alignment24">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Open folders with: </property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkRadioButton" id="radio_open_folder_stock">
<property name="visible">True</property>
<property name="can_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="label" translatable="yes">Open folder with:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkAlignment" id="alignment25">
<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>
<child>
<widget class="GtkRadioButton" id="radio_open_folder_custom">
<property name="visible">True</property>
<property name="can_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="label" translatable="yes">Custom:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_open_folder_stock</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="combo_file_manager">
<widget class="GtkAlignment" id="alignment26">
<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="items" translatable="yes">Konqueror
<child>
<widget class="GtkComboBoxEntry" id="combo_file_manager">
<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="items" translatable="yes">Konqueror
Nautilus
Thunar</property>
<child internal-child="entry">
<widget class="GtkEntry" id="comboboxentry-entry1">
<child internal-child="entry">
<widget class="GtkEntry" id="comboboxentry-entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment27">
<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>
<child>
<widget class="GtkEntry" id="txt_open_folder_location">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -2290,11 +2344,17 @@ Thunar</property>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>

View File

@ -57,6 +57,9 @@ class PreferencesDlg:
# Load settings into dialog
try:
self.glade.get_widget("combo_file_manager").set_active(self.preferences.get("file_manager"))
self.glade.get_widget("txt_open_folder_location").set_text(self.preferences.get("open_folder_location"))
self.glade.get_widget("radio_open_folder_stock").set_active(self.preferences.get("open_folder_stock"))
self.glade.get_widget("radio_open_folder_custom").set_active(self.preferences.get("open_folder_custom"))
self.glade.get_widget("combo_encin").set_active(self.preferences.get("encin_state"))
self.glade.get_widget("combo_encout").set_active(self.preferences.get("encout_state"))
self.glade.get_widget("combo_enclevel").set_active(self.preferences.get("enclevel_type"))
@ -158,6 +161,9 @@ class PreferencesDlg:
def ok_clicked(self, source, interface):
self.dialog.hide()
self.preferences.set("file_manager", self.glade.get_widget("combo_file_manager").get_active())
self.preferences.set("open_folder_custom", self.glade.get_widget("radio_open_folder_custom").get_active())
self.preferences.set("open_folder_stock", self.glade.get_widget("radio_open_folder_stock").get_active())
self.preferences.set("open_folder_location", self.glade.get_widget("txt_open_folder_location").get_text())
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())

View File

@ -639,12 +639,15 @@ class DelugeGTK:
unique_ids = self.get_selected_torrent_rows()
try:
for uid in unique_ids:
if self.config.get("file_manager") == 0:
command = "konqueror"
if self.config.get("file_manager") == 1:
command = "nautilus"
if self.config.get("file_manager") == 2:
command = "thunar"
if self.config.get("open_folder_stock"):
if self.config.get("file_manager") == 0:
command = "konqueror"
if self.config.get("file_manager") == 1:
command = "nautilus"
if self.config.get("file_manager") == 2:
command = "thunar"
elif self.config.get("open_folder_custom"):
command = self.config.get("open_folder_location")
os.system('%s %s' %(command, self.manager.unique_IDs[uid].save_dir))
except KeyError:
pass

View File

@ -41,6 +41,9 @@ import os.path
DEFAULT_PREFS = {
"file_manager" : common.FileManager.nautilus,
"open_folder_stock" : True,
"open_folder_custom" : False,
"open_folder_location": "",
"send_info" : True,
"auto_end_seeding" : False,
"auto_seed_ratio" : 0,