Verified Kaydet (Commit) d5031d20 authored tarafından Erdem Ersoy's avatar Erdem Ersoy

Fix actions after implement sorting (2/X)

* Fix "Uninstall" menu item function
üst 78f3e7ab
...@@ -244,7 +244,7 @@ class MainWindow(object): ...@@ -244,7 +244,7 @@ class MainWindow(object):
if len(search_entry_text) == 0 and not self.HeaderBarShowButton.get_active(): if len(search_entry_text) == 0 and not self.HeaderBarShowButton.get_active():
return True return True
if len(search_entry_text) == 0 and self.HeaderBarShowButton.get_active(): if len(search_entry_text) == 0 and self.HeaderBarShowButton.get_active():
if UninstallWindow.at_uninstallation or UpdateAllWindow.at_updating: if UpdateAllWindow.at_updating:
return True return True
else: else:
return is_installed return is_installed
...@@ -253,7 +253,7 @@ class MainWindow(object): ...@@ -253,7 +253,7 @@ class MainWindow(object):
return True return True
elif (real_name.lower().count(search_entry_text.lower()) > 0 or name.lower().count( elif (real_name.lower().count(search_entry_text.lower()) > 0 or name.lower().count(
search_entry_text.lower()) > 0) and self.HeaderBarShowButton.get_active(): search_entry_text.lower()) > 0) and self.HeaderBarShowButton.get_active():
if UninstallWindow.at_uninstallation or UpdateAllWindow.at_updating: if UpdateAllWindow.at_updating:
return True return True
else: else:
return is_installed return is_installed
...@@ -576,8 +576,12 @@ class MainWindow(object): ...@@ -576,8 +576,12 @@ class MainWindow(object):
InfoWindow(self.Application, info_str, ref) InfoWindow(self.Application, info_str, ref)
def on_uninstall(self, menu_item): def on_uninstall(self, menu_item):
UninstallWindow.at_uninstallation = True if not self.HeaderBarShowButton.get_active():
self.SearchFilter.refilter() button_not_pressed_already = True
elif self.HeaderBarShowButton.get_active():
button_not_pressed_already = False
self.HeaderBarShowButton.set_active(False)
self.SearchFilter.refilter()
selection = self.TreeViewMain.get_selection() selection = self.TreeViewMain.get_selection()
tree_model, tree_iter = selection.get_selected() tree_model, tree_iter = selection.get_selected()
...@@ -595,7 +599,8 @@ class MainWindow(object): ...@@ -595,7 +599,8 @@ class MainWindow(object):
branch = tree_model.get_value(tree_iter, 2) branch = tree_model.get_value(tree_iter, 2)
UninstallWindow(self.Application, self.FlatpakInstallation, real_name, UninstallWindow(self.Application, self.FlatpakInstallation, real_name,
arch, branch, tree_model, tree_iter, selection, self.SearchFilter, self.HeaderBarShowButton) arch, branch, tree_model, tree_iter, selection, self.SearchFilter, self.HeaderBarShowButton,
button_not_pressed_already)
def on_install(self, menu_item): def on_install(self, menu_item):
selection = self.TreeViewMain.get_selection() selection = self.TreeViewMain.get_selection()
......
...@@ -35,10 +35,9 @@ gettext.install("pardus-flatpak-gui", "/usr/share/locale/") ...@@ -35,10 +35,9 @@ gettext.install("pardus-flatpak-gui", "/usr/share/locale/")
class UninstallWindow(object): class UninstallWindow(object):
at_uninstallation = False
def __init__(self, application, flatpak_installation, real_name, arch, branch, def __init__(self, application, flatpak_installation, real_name, arch, branch,
tree_model, tree_iter, selection, search_filter, show_button): tree_model, tree_iter, selection, search_filter, show_button,
button_not_pressed_already):
self.Application = application self.Application = application
self.RealName = real_name self.RealName = real_name
...@@ -65,6 +64,7 @@ class UninstallWindow(object): ...@@ -65,6 +64,7 @@ class UninstallWindow(object):
self.Selection = selection self.Selection = selection
self.SearchFilter = search_filter self.SearchFilter = search_filter
self.HeaderBarShowButton = show_button self.HeaderBarShowButton = show_button
self.ButtonNotPressedAlready = button_not_pressed_already
self.handler_id = self.FlatpakTransaction.connect( self.handler_id = self.FlatpakTransaction.connect(
"new-operation", "new-operation",
...@@ -164,33 +164,28 @@ class UninstallWindow(object): ...@@ -164,33 +164,28 @@ class UninstallWindow(object):
name = "" name = ""
GLib.idle_add(self.TreeModel.set_row, tree_iter = self.TreeModel.convert_iter_to_child_iter(self.TreeIter)
self.TreeIter, [uninstalled_ref_real_name, tree_model = self.TreeModel.get_model()
uninstalled_ref_arch,
uninstalled_ref_branch, GLib.idle_add(tree_model.set_row,
uninstalled_ref_remote, tree_iter, [uninstalled_ref_real_name,
installed_size_mib_str, uninstalled_ref_arch,
download_size_mib_str, uninstalled_ref_branch,
name], uninstalled_ref_remote,
installed_size_mib_str,
download_size_mib_str,
name],
priority=GLib.PRIORITY_DEFAULT) priority=GLib.PRIORITY_DEFAULT)
time.sleep(0.2) time.sleep(0.2)
GLib.idle_add(self.Selection.unselect_iter, GLib.idle_add(self.Selection.unselect_all,
self.TreeIter, data=None,
priority=GLib.PRIORITY_DEFAULT) priority=GLib.PRIORITY_DEFAULT)
time.sleep(0.2) time.sleep(0.2)
self.SearchFilter.refilter() if self.ButtonNotPressedAlready:
time.sleep(0.3) pass
elif not self.HeaderBarShowButton.get_active():
UninstallWindow.at_uninstallation = False
if self.HeaderBarShowButton.get_active():
GLib.idle_add(self.HeaderBarShowButton.set_active,
False,
priority=GLib.PRIORITY_DEFAULT)
time.sleep(0.2)
GLib.idle_add(self.HeaderBarShowButton.set_active, GLib.idle_add(self.HeaderBarShowButton.set_active,
True, True,
priority=GLib.PRIORITY_DEFAULT) priority=GLib.PRIORITY_DEFAULT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment