forked from cromer/pamac-classic
add right click menu, reinstall ans optdeps install
This commit is contained in:
parent
18acb8ddc6
commit
03beafc4b2
@ -666,6 +666,7 @@
|
||||
<property name="search_column">0</property>
|
||||
<property name="fixed_height_mode">True</property>
|
||||
<property name="show_expanders">False</property>
|
||||
<signal name="button-press-event" handler="on_list_treeview_button_press_event" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="list_treeview_selection">
|
||||
<signal name="changed" handler="on_list_treeview_selection_changed" swapped="no"/>
|
||||
@ -681,10 +682,10 @@
|
||||
<property name="sort_indicator">True</property>
|
||||
<property name="sort_column_id">1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererToggle" id="cellrenderertoggle1">
|
||||
<object class="GtkCellRendererToggle" id="select_toggle">
|
||||
<property name="xpad">5</property>
|
||||
<property name="xalign">0</property>
|
||||
<signal name="toggled" handler="on_cellrenderertoggle1_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_select_toggle_toggled" swapped="no"/>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="activatable">2</attribute>
|
||||
@ -1137,24 +1138,6 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="repos_list">
|
||||
<columns>
|
||||
<!-- column-name name -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="search_list">
|
||||
<columns>
|
||||
<!-- column-name terms -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="state_list">
|
||||
<columns>
|
||||
<!-- column-name state -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="packages_list">
|
||||
<columns>
|
||||
<!-- column-name name -->
|
||||
@ -1175,6 +1158,24 @@
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="repos_list">
|
||||
<columns>
|
||||
<!-- column-name name -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="search_list">
|
||||
<columns>
|
||||
<!-- column-name terms -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="state_list">
|
||||
<columns>
|
||||
<!-- column-name state -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="transaction_sum">
|
||||
<columns>
|
||||
<!-- column-name action -->
|
||||
|
@ -23,5 +23,9 @@ if not common.pid_file_exists():
|
||||
bus = dbus.SystemBus()
|
||||
bus.add_signal_receiver(reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone")
|
||||
bus.add_signal_receiver(error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError")
|
||||
try:
|
||||
transaction.Refresh()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
loop.run()
|
||||
|
@ -923,23 +923,72 @@ class Handler:
|
||||
current_filter = ('search', search_entry.get_text().split())
|
||||
set_packages_list()
|
||||
|
||||
#~ def on_list_treeview_button_press_event(self, treeview, event):
|
||||
#~ if event.button == 1: # left click
|
||||
#~ treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y))
|
||||
#~ treeiter = packages_list.get_iter(treepath)
|
||||
#~ if treeiter:
|
||||
#~ if packages_list[treeiter][0] != _('No package found'):
|
||||
#~ if packages_list[treeiter][0] in transaction.localpkgs.keys():
|
||||
#~ set_infos_list(transaction.localpkgs[packages_list[treeiter][0]])
|
||||
#~ set_deps_list(transaction.localpkgs[packages_list[treeiter][0]], "local")
|
||||
#~ set_details_list(transaction.localpkgs[packages_list[treeiter][0]], "local")
|
||||
#~ set_files_list(transaction.localpkgs[packages_list[treeiter][0]])
|
||||
#~ files_scrolledwindow.set_visible(True)
|
||||
#~ elif packages_list[treeiter][0] in transaction.syncpkgs.keys():
|
||||
#~ set_infos_list(transaction.syncpkgs[packages_list[treeiter][0]])
|
||||
#~ set_deps_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync")
|
||||
#~ set_details_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync")
|
||||
#~ files_scrolledwindow.set_visible(False)
|
||||
menu = Gtk.Menu()
|
||||
def on_list_treeview_button_press_event(self, treeview, event):
|
||||
def mark_to_reinstall(widget, treeiter):
|
||||
packages_list[treeiter][3] = True
|
||||
packages_list[treeiter][4] = to_install_icon
|
||||
transaction.to_add.add(packages_list[treeiter][0])
|
||||
def select_optdeps(widget, pkgname, optdeps):
|
||||
choose_label.set_markup(_('<b>{pkgname} has {number} uninstalled optional deps.\nPlease choose the one(s) you want to install:</b>').format(pkgname = pkgname, number = str(len(optdeps))))
|
||||
choose_list.clear()
|
||||
for long_string in optdeps:
|
||||
choose_list.append([False, long_string])
|
||||
ChooseDialog.run()
|
||||
for long_string in transaction.to_provide:
|
||||
transaction.to_add.add(long_string.split(':')[0])
|
||||
def install_with_optdeps(widget, treeiter, pkgname, optdeps):
|
||||
select_optdeps(widget, pkgname, optdeps)
|
||||
mark_to_reinstall(widget, treeiter)
|
||||
# Check if right mouse button was clicked
|
||||
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3:
|
||||
treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y))
|
||||
treeiter = packages_list.get_iter(treepath)
|
||||
if treeiter:
|
||||
if packages_list[treeiter][0] != _('No package found'):
|
||||
self.menu = Gtk.Menu()
|
||||
if packages_list[treeiter][0] in transaction.to_remove | transaction.to_add:
|
||||
item = Gtk.MenuItem(_('Unselect'))
|
||||
item.connect('activate', self.on_select_toggle_toggled, treeiter)
|
||||
self.menu.append(item)
|
||||
elif packages_list[treeiter][0] in transaction.localpkgs.keys():
|
||||
item = Gtk.MenuItem(_('Remove'))
|
||||
item.connect('activate', self.on_select_toggle_toggled, treeiter)
|
||||
self.menu.append(item)
|
||||
item = Gtk.MenuItem(_('Reinstall'))
|
||||
item.connect('activate', mark_to_reinstall, treeiter)
|
||||
self.menu.append(item)
|
||||
optdeps_strings = transaction.localpkgs[packages_list[treeiter][0]].optdepends
|
||||
if optdeps_strings:
|
||||
available_optdeps = []
|
||||
for optdep_string in optdeps_strings:
|
||||
optdep = optdep_string.split(':')[0]
|
||||
if not optdep in transaction.localpkgs.keys():
|
||||
available_optdeps.append(optdep_string)
|
||||
if available_optdeps:
|
||||
item = Gtk.MenuItem(_('Install optional deps'))
|
||||
item.connect('activate', select_optdeps, packages_list[treeiter][0], available_optdeps)
|
||||
self.menu.append(item)
|
||||
else:
|
||||
item = Gtk.ImageMenuItem(_('Install'))
|
||||
item.connect('activate', self.on_select_toggle_toggled, treeiter)
|
||||
self.menu.append(item)
|
||||
optdeps_strings = transaction.syncpkgs[packages_list[treeiter][0]].optdepends
|
||||
if optdeps_strings:
|
||||
available_optdeps = []
|
||||
for optdep_string in optdeps_strings:
|
||||
optdep = optdep_string.split(':')[0]
|
||||
if not optdep in transaction.localpkgs.keys():
|
||||
available_optdeps.append(optdep_string)
|
||||
if available_optdeps:
|
||||
item = Gtk.MenuItem(_('Install with optional deps'))
|
||||
item.connect('activate', install_with_optdeps, treeiter, packages_list[treeiter][0], available_optdeps)
|
||||
self.menu.append(item)
|
||||
treeview.grab_focus()
|
||||
treeview.set_cursor(treepath, viewcolumn, 0)
|
||||
self.menu.show_all()
|
||||
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||
return True
|
||||
|
||||
def on_list_treeview_selection_changed(self, treeview):
|
||||
if not packages_list_clearing:
|
||||
@ -1000,9 +1049,13 @@ class Handler:
|
||||
current_filter = ('repo', repos_list[line][0])
|
||||
set_packages_list()
|
||||
|
||||
def on_cellrenderertoggle1_toggled(self, widget, line):
|
||||
def on_select_toggle_toggled(self, widget, line):
|
||||
if packages_list[line][1] is True:
|
||||
if packages_list[line][0] in transaction.to_remove:
|
||||
if packages_list[line][0] in transaction.to_add:
|
||||
packages_list[line][3] = True
|
||||
packages_list[line][4] = installed_icon
|
||||
transaction.to_add.discard(packages_list[line][0])
|
||||
elif packages_list[line][0] in transaction.to_remove:
|
||||
packages_list[line][3] = True
|
||||
packages_list[line][4] = installed_icon
|
||||
transaction.to_remove.discard(packages_list[line][0])
|
||||
|
@ -1,13 +0,0 @@
|
||||
<message>Authentication is required</message>
|
||||
<message xml:lang="ca">Autenticació requerida</message>
|
||||
<message xml:lang="da">Autentificering er krævet</message>
|
||||
<message xml:lang="de">Authentifikation wird benötigt</message>
|
||||
<message xml:lang="el">Απαιτείται πιστοποίηση</message>
|
||||
<message xml:lang="es">Se requiere autentificación</message>
|
||||
<message xml:lang="fr">Authentification nécessaire</message>
|
||||
<message xml:lang="it">È richiesta l'autenticazione</message>
|
||||
<message xml:lang="nb">Autentifisering er krevd</message>
|
||||
<message xml:lang="po">Autentyfikacja jest wymagana</message>
|
||||
<message xml:lang="pt_BR">Autenticação é necessária</message>
|
||||
<message xml:lang="ro">Este necesară autentificarea</message>
|
||||
<message xml:lang="tr">Yetkilendirme Gerekiyor</message>
|
Loading…
Reference in New Issue
Block a user