Skip to content

Commit

Permalink
Bug fixes & adjustments
Browse files Browse the repository at this point in the history
- Bug fix regarding pause buttons in download lists (got rid of overly complicated system)
- Shutdown after completion now works on Windows
- Small UI adjustments
  • Loading branch information
giantpinkrobots committed Oct 30, 2024
1 parent 6c2f10b commit b6fd218
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/download/actionrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def create_actionrow(self, filename):
pause_button.get_style_context().add_class("circular")
pause_button.connect("clicked", on_pause_clicked, self, pause_button, download_item, False)

self.pause_buttons.append(pause_button)
button_box.append(pause_button)

stop_button = Gtk.Button.new_from_icon_name("process-stop-symbolic")
Expand All @@ -77,7 +76,7 @@ def create_actionrow(self, filename):

create_status_page(self, 1)

return [progress_bar, speed_label, self.pause_buttons[len(self.pause_buttons)-1], download_item, filename_label]
return [progress_bar, speed_label, pause_button, download_item, filename_label]

def on_pause_clicked(button, self, pause_button, download_item, force_pause):
download_thread = self.downloads[download_item.index]
Expand Down
15 changes: 10 additions & 5 deletions src/download/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import string
import random
import textwrap
import os
from gettext import gettext as _

def listen_to_aria2(self, variaapp):
Expand Down Expand Up @@ -113,11 +114,15 @@ def shutdown_dialog_cancel_pressed(dialog, response_id, variamain, variaapp):

def initiate_shutdown(variamain, shutdown_id):
if (variamain.shutdown_dialog_raised == True) and (shutdown_id == variamain.shutdown_id):
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
'org.freedesktop.login1', '/org/freedesktop/login1',
'org.freedesktop.login1.Manager', None)
proxy.call_sync('PowerOff', GLib.Variant('(b)', (True,)), Gio.DBusCallFlags.NONE, -1, None)
if os.name == 'nt':
os.system('shutdown -s -t 0')
else:
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
'org.freedesktop.login1', '/org/freedesktop/login1',
'org.freedesktop.login1.Manager', None)
proxy.call_sync('PowerOff', GLib.Variant('(b)', (True,)), Gio.DBusCallFlags.NONE, -1, None)

exit()

def raise_exit_dialog(variamain, variaapp):
Expand Down
3 changes: 1 addition & 2 deletions src/initiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ def initiate(self, variaapp, variaVersion, first_run):
self.terminating = False

if ("dev" in variaVersion):
#self.get_style_context().add_class("devel")
self.get_style_context().add_class("devel")
Gtk.Settings.get_default().set_property("gtk-icon-theme-name", "Adwaita")

self.overlay_split_view = Adw.OverlaySplitView.new()
self.set_content(self.overlay_split_view)

self.downloads = []
self.pause_buttons = []
self.all_paused = False

self.shutdown_mode = False
Expand Down
10 changes: 5 additions & 5 deletions src/variamain.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def check_download_status(self):
if (download_thread.download.is_complete == 1):
download_thread.cancelled = True
download_thread.speed_label.set_text(_("Download complete."))
GLib.idle_add(self.pause_buttons[i].set_visible, False)
GLib.idle_add(download_thread.pause_button.set_visible, False)
self.filter_download_list("no", self.applied_filter)

elif (download_thread.download.status == "error") or (download_thread.download.status == "removed"):
Expand All @@ -202,10 +202,10 @@ def check_download_status(self):
download_thread.speed_label.set_text(_("An error occurred:") + " " + str(download_thread.download.error_code))
download_thread.stop(False)

GLib.idle_add(self.pause_buttons[i].set_visible, False)
GLib.idle_add(download_thread.pause_button.set_visible, False)
self.filter_download_list("no", self.applied_filter)
except:
GLib.idle_add(self.pause_buttons[i].set_visible, False)
GLib.idle_add(download_thread.pause_button.set_visible, False)
self.filter_download_list("no", self.applied_filter)
pass
i += 1
Expand Down Expand Up @@ -242,7 +242,7 @@ def pause_all(self, header_pause_content):

pause_button_images.append(Gtk.Image.new())
pause_button_images[i].set_from_icon_name("media-playback-start-symbolic")
self.pause_buttons[i].set_child(pause_button_images[i])
download_thread.pause_button.set_child(pause_button_images[i])

download_thread.save_state()

Expand All @@ -257,7 +257,7 @@ def pause_all(self, header_pause_content):

pause_button_images.append(Gtk.Image.new())
pause_button_images[i].set_from_icon_name("media-playback-pause-symbolic")
self.pause_buttons[i].set_child(pause_button_images[i])
download_thread.pause_button.set_child(pause_button_images[i])

i += 1
if ((header_pause_content != "no") and (i > 0)):
Expand Down
2 changes: 1 addition & 1 deletion src/window/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def window_create_content(self, threading):
self.download_list.set_margin_start(6)
self.download_list.set_margin_end(6)
self.download_list.set_margin_bottom(6)
self.download_list.set_margin_top(6)
self.download_list.set_margin_top(1)
self.download_list_box.set_hexpand(True)
self.download_list_box.set_vexpand(True)

Expand Down

0 comments on commit b6fd218

Please sign in to comment.