add "open containing folder" by me and lifetime totals in tray tooltip by micah
This commit is contained in:
parent
5b522678e0
commit
8bd900d189
|
@ -2245,6 +2245,80 @@ HTTP W/ Auth</property>
|
|||
<property name="padding">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame19">
|
||||
<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_xalign">0</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment23">
|
||||
<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="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox7">
|
||||
<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">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">15</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label39">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Open folders with: </property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<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">
|
||||
<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>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label36">
|
||||
<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"><b>Desktop File Manager</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame3">
|
||||
<property name="label_xalign">0</property>
|
||||
|
@ -2303,7 +2377,7 @@ HTTP W/ Auth</property>
|
|||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -2355,7 +2429,7 @@ HTTP W/ Auth</property>
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -2398,7 +2472,7 @@ information is sent.</property>
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -191,5 +191,19 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem1">
|
||||
<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">_Open Containing Folder</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="open_folder_clicked"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="menu-item-image15">
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
|
|
|
@ -69,7 +69,13 @@ def fsize(fsize_b):
|
|||
if fsize_mb < 1000:
|
||||
return "%.1f %s" % (fsize_mb, _("MiB"))
|
||||
fsize_gb = float (fsize_mb / 1024.0)
|
||||
return "%.1f %s" % (fsize_gb, _("GiB"))
|
||||
if fsize_gb < 1000:
|
||||
return "%.1f %s" % (fsize_gb, _("GiB"))
|
||||
fsize_tb = float (fsize_gb / 1024.0)
|
||||
if fsize_tb < 1000:
|
||||
return "%.1f %s" % (fsize_tb, _("TiB"))
|
||||
fsize_pb = float (fsize_tb / 1024.0)
|
||||
return "%.1f %s" % (fsize_pb, _("PiB"))
|
||||
|
||||
# Returns a formatted string representing a percentage
|
||||
def fpcnt(dec):
|
||||
|
@ -159,3 +165,5 @@ class EncLevel:
|
|||
|
||||
class ProxyType:
|
||||
none, socks4, socks5, socks5_pw, http, http_pw = range(6)
|
||||
class FileManager:
|
||||
konqueror, nautilus, thunar = range(3)
|
||||
|
|
|
@ -56,6 +56,7 @@ class PreferencesDlg:
|
|||
def show(self, interface, window):
|
||||
# Load settings into dialog
|
||||
try:
|
||||
self.glade.get_widget("combo_file_manager").set_active(self.preferences.get("file_manager"))
|
||||
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"))
|
||||
|
@ -156,6 +157,7 @@ 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("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())
|
||||
|
|
|
@ -52,6 +52,9 @@ class DelugeGTK:
|
|||
#Start the Deluge Manager:
|
||||
self.manager = core.Manager(common.CLIENT_CODE, common.CLIENT_VERSION,
|
||||
'%s %s'%(common.PROGRAM_NAME, common.PROGRAM_VERSION), common.CONFIG_DIR)
|
||||
self.logdir = os.path.join(common.CONFIG_DIR, 'logs')
|
||||
self.alltime_download = None
|
||||
self.alltime_upload = None
|
||||
self.plugins = plugins.PluginManager(self.manager, self)
|
||||
self.plugins.add_plugin_dir(common.PLUGIN_DIR)
|
||||
if os.path.isdir(os.path.join(common.CONFIG_DIR , 'plugins')):
|
||||
|
@ -499,6 +502,7 @@ class DelugeGTK:
|
|||
"tor_pause": self.tor_pause,
|
||||
"update_tracker": self.update_tracker,
|
||||
"clear_finished": self.clear_finished,
|
||||
"open_folder_clicked": self.open_folder,
|
||||
"queue_up": self.q_torrent_up,
|
||||
"queue_down": self.q_torrent_down,
|
||||
"queue_bottom": self.q_to_bottom,
|
||||
|
@ -633,7 +637,23 @@ class DelugeGTK:
|
|||
return is_selected
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def open_folder(self, widget):
|
||||
unique_ids = self.get_selected_torrent_rows()
|
||||
# try:
|
||||
for uid in unique_ids:
|
||||
if self.config.get("file_manager") == 0:
|
||||
command = "/usr/bin/konqueror"
|
||||
if self.config.get("file_manager") == 1:
|
||||
command = "/usr/bin/nautilus"
|
||||
if self.config.get("file_manager") == 2:
|
||||
command = "/usr/bin/thunar"
|
||||
# print "command %s uid %i dir %s\n" %(command, uid, self.manager.unique_IDs[uid].save_dir)
|
||||
os.system('%s %s' %(command, self.manager.unique_IDs[uid].save_dir))
|
||||
self.update()
|
||||
# except KeyError:
|
||||
# pass
|
||||
|
||||
def tor_start(self, widget):
|
||||
unique_ids = self.get_selected_torrent_rows()
|
||||
try:
|
||||
|
@ -800,6 +820,20 @@ class DelugeGTK:
|
|||
|
||||
## Start the timer that updates the interface
|
||||
def start(self, start_in_tray=False, cmd_line_torrents=None):
|
||||
if not os.path.isdir(self.logdir):
|
||||
os.mkdir(self.logdir)
|
||||
log = os.path.join(self.logdir, "stats.log")
|
||||
try:
|
||||
logfile = open(log, "r")
|
||||
except:
|
||||
self.alltime_download = 0
|
||||
self.alltime_upload = 0
|
||||
else:
|
||||
readlines = logfile.readlines()
|
||||
self.alltime_download = long(readlines[0])
|
||||
self.alltime_upload = long(readlines[1])
|
||||
logfile.close()
|
||||
|
||||
if cmd_line_torrents is None:
|
||||
cmd_line_torrents = []
|
||||
|
||||
|
@ -947,10 +981,14 @@ class DelugeGTK:
|
|||
max_connections = _("Unlimited")
|
||||
else:
|
||||
max_connections = int(self.config.get("max_connections_global"))
|
||||
|
||||
dlall = long(core_state['total_downloaded']) + self.alltime_download
|
||||
ulall = long(core_state['total_uploaded']) + self.alltime_upload
|
||||
|
||||
dlspeed = common.fspeed(core_state['download_rate'])
|
||||
ulspeed = common.fspeed(core_state['upload_rate'])
|
||||
dltotal = common.fsize(core_state['total_downloaded'])
|
||||
ultotal = common.fsize(core_state['total_uploaded'])
|
||||
dltotal = common.fsize(dlall)
|
||||
ultotal = common.fsize(ulall)
|
||||
|
||||
if self.config.get("max_download_speed") < 0:
|
||||
dlspeed_max = _("Unlimited")
|
||||
|
@ -1325,6 +1363,16 @@ class DelugeGTK:
|
|||
self.shutdown()
|
||||
|
||||
def shutdown(self):
|
||||
core_state = self.manager.get_state()
|
||||
|
||||
dlall = long(core_state['total_downloaded']) + self.alltime_download
|
||||
ulall = long(core_state['total_uploaded']) + self.alltime_upload
|
||||
|
||||
log = os.path.join(self.logdir, "stats.log")
|
||||
logfile = open(log, "w")
|
||||
logfile.writelines([str(dlall)+'\n', str(ulall)+'\n'])
|
||||
logfile.close()
|
||||
|
||||
enabled_plugins = ':'.join(self.plugins.get_enabled_plugins())
|
||||
self.config.set('enabled_plugins', enabled_plugins)
|
||||
self.save_window_settings()
|
||||
|
|
|
@ -40,6 +40,7 @@ import common
|
|||
import os.path
|
||||
|
||||
DEFAULT_PREFS = {
|
||||
"file_manager" : common.FileManager.nautilus,
|
||||
"send_info" : True,
|
||||
"auto_end_seeding" : False,
|
||||
"auto_seed_ratio" : 0,
|
||||
|
|
Loading…
Reference in New Issue