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):
if len(search_entry_text) == 0 and not self.HeaderBarShowButton.get_active():
return True
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
else:
return is_installed
......@@ -253,7 +253,7 @@ class MainWindow(object):
return True
elif (real_name.lower().count(search_entry_text.lower()) > 0 or name.lower().count(
search_entry_text.lower()) > 0) and self.HeaderBarShowButton.get_active():
if UninstallWindow.at_uninstallation or UpdateAllWindow.at_updating:
if UpdateAllWindow.at_updating:
return True
else:
return is_installed
......@@ -576,7 +576,11 @@ class MainWindow(object):
InfoWindow(self.Application, info_str, ref)
def on_uninstall(self, menu_item):
UninstallWindow.at_uninstallation = True
if not self.HeaderBarShowButton.get_active():
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()
......@@ -595,7 +599,8 @@ class MainWindow(object):
branch = tree_model.get_value(tree_iter, 2)
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):
selection = self.TreeViewMain.get_selection()
......
......@@ -35,10 +35,9 @@ gettext.install("pardus-flatpak-gui", "/usr/share/locale/")
class UninstallWindow(object):
at_uninstallation = False
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.RealName = real_name
......@@ -65,6 +64,7 @@ class UninstallWindow(object):
self.Selection = selection
self.SearchFilter = search_filter
self.HeaderBarShowButton = show_button
self.ButtonNotPressedAlready = button_not_pressed_already
self.handler_id = self.FlatpakTransaction.connect(
"new-operation",
......@@ -164,8 +164,11 @@ class UninstallWindow(object):
name = ""
GLib.idle_add(self.TreeModel.set_row,
self.TreeIter, [uninstalled_ref_real_name,
tree_iter = self.TreeModel.convert_iter_to_child_iter(self.TreeIter)
tree_model = self.TreeModel.get_model()
GLib.idle_add(tree_model.set_row,
tree_iter, [uninstalled_ref_real_name,
uninstalled_ref_arch,
uninstalled_ref_branch,
uninstalled_ref_remote,
......@@ -175,22 +178,14 @@ class UninstallWindow(object):
priority=GLib.PRIORITY_DEFAULT)
time.sleep(0.2)
GLib.idle_add(self.Selection.unselect_iter,
self.TreeIter,
priority=GLib.PRIORITY_DEFAULT)
time.sleep(0.2)
self.SearchFilter.refilter()
time.sleep(0.3)
UninstallWindow.at_uninstallation = False
if self.HeaderBarShowButton.get_active():
GLib.idle_add(self.HeaderBarShowButton.set_active,
False,
GLib.idle_add(self.Selection.unselect_all,
data=None,
priority=GLib.PRIORITY_DEFAULT)
time.sleep(0.2)
if self.ButtonNotPressedAlready:
pass
elif not self.HeaderBarShowButton.get_active():
GLib.idle_add(self.HeaderBarShowButton.set_active,
True,
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