unactive apply and cancel buttons when nothing to do and add mark as explicitly installed option

This commit is contained in:
guinux 2014-02-05 19:24:05 +01:00
parent 803952f5df
commit 56f5b057c5
4 changed files with 141 additions and 70 deletions

View File

@ -342,7 +342,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="manager_valid_button">
<object class="GtkButton" id="ManagerValidButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -351,7 +351,7 @@
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_manager_valid_button_clicked" swapped="no"/>
<signal name="clicked" handler="on_ManagerValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -360,7 +360,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="manager_cancel_button">
<object class="GtkButton" id="ManagerCancelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -369,7 +369,7 @@
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_manager_cancel_button_clicked" swapped="no"/>
<signal name="clicked" handler="on_ManagerCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -378,7 +378,7 @@
</packing>
</child>
<child>
<object class="GtkMenuButton" id="menu_button">
<object class="GtkMenuButton" id="MenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>

View File

@ -419,16 +419,24 @@ class PamacDBusService(dbus.service.Object):
(is_authorized,is_challenge,details) = policykit_authority.CheckAuthorization(Subject, action, {'': ''}, dbus.UInt32(1), '',timeout=2147483)
return is_authorized
@dbus.service.method('org.manjaro.pamac', 'si', 's')
def SetPkgReason(self, pkgname, reason):
error = ''
@dbus.service.method('org.manjaro.pamac', 'si', 's', sender_keyword='sender', connection_keyword='connexion')
def SetPkgReason(self, pkgname, reason, sender=None, connexion=None):
try:
pkg = self.localdb.get_pkg(pkgname)
if pkg:
self.handle.set_pkgreason(pkg, reason)
except Exception as e:
error = format_error(e.args)
return error
authorized = self.policykit_test(sender,connexion,'org.manjaro.pamac.commit')
except dbus.exceptions.DBusException as e:
return _('Authentication failed')
else:
if authorized:
error = ''
try:
pkg = self.localdb.get_pkg(pkgname)
if pkg:
self.handle.set_pkgreason(pkg, reason)
except Exception as e:
error = format_error(e.args)
return error
else :
return _('Authentication failed')
@dbus.service.method('org.manjaro.pamac', '', 's', async_callbacks=('success', 'nosuccess'))
def CheckUpdates(self, success, nosuccess):

View File

@ -76,11 +76,15 @@ AboutDialog = interface.get_object('AboutDialog')
PackagesChooserDialog = interface.get_object('PackagesChooserDialog')
HistoryWindow = interface.get_object('HistoryWindow')
history_textview = interface.get_object('history_textview')
ManagerValidButton = interface.get_object('ManagerValidButton')
ManagerCancelButton = interface.get_object('ManagerCancelButton')
files_buffer = files_textview.get_buffer()
history_buffer = history_textview.get_buffer()
AboutDialog.set_version(version)
search_aur_button.set_visible(config.enable_aur)
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
search_dict = {}
groups_dict = {}
@ -336,6 +340,14 @@ def refresh_packages_list(liststore):
repo_column.set_sort_indicator(False)
size_column.set_sort_indicator(False)
packages_list_treeview.thaw_child_notify()
# clear infos tabs
name_label.set_markup('')
desc_label.set_markup('')
link_label.set_markup('')
licenses_label.set_markup('')
deps_list.clear()
details_list.clear()
files_buffer.delete(files_buffer.get_start_iter(), files_buffer.get_end_iter())
ManagerWindow.get_window().set_cursor(None)
def set_infos_list(pkg):
@ -432,6 +444,8 @@ def handle_error(error):
transaction.to_update.clear()
transaction.to_load.clear()
transaction.to_build.clear()
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
def handle_reply(reply):
if transaction.to_build:
@ -444,9 +458,6 @@ def handle_reply(reply):
end_iter = transaction.progress_buffer.get_end_iter()
transaction.progress_buffer.insert(end_iter, str(reply))
else:
#~ transaction.ProgressWindow.hide()
#~ while Gtk.events_pending():
#~ Gtk.main_iteration()
transaction.get_updates()
transaction.Release()
transaction.get_handle()
@ -455,6 +466,8 @@ def handle_reply(reply):
transaction.to_remove.clear()
transaction.to_update.clear()
transaction.to_load.clear()
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
global search_dict
global groups_dict
global states_dict
@ -504,6 +517,8 @@ def on_TransCancelButton_clicked(*args):
transaction.to_update.clear()
transaction.to_load.clear()
transaction.to_build.clear()
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
@ -531,6 +546,8 @@ def on_ProgressCancelButton_clicked(*args):
transaction.to_update.clear()
transaction.to_load.clear()
transaction.to_build.clear()
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
transaction.Interrupt()
ManagerWindow.get_window().set_cursor(None)
transaction.ProgressWindow.hide()
@ -553,18 +570,27 @@ def mark_to_install(widget, pkg):
transaction.to_build.append(pkg)
else:
transaction.to_add.add(pkg.name)
ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True)
def mark_to_reinstall(widget, pkg):
transaction.to_add.add(pkg.name)
ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True)
def mark_to_remove(widget, pkg):
transaction.to_remove.add(pkg.name)
ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True)
def mark_to_deselect(widget, pkg):
transaction.to_remove.discard(pkg.name)
transaction.to_add.discard(pkg.name)
if pkg in transaction.to_build:
transaction.to_build.remove(pkg)
if not transaction.to_add and not transaction.to_remove and not transaction.to_build:
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
def select_optdeps(widget, pkg, optdeps):
transaction.choose_label.set_markup('<b>{}</b>'.format(_('{pkgname} has {number} uninstalled optional deps.\nPlease choose those you would like to install:').format(pkgname = pkg.name, number = str(len(optdeps)))))
@ -572,10 +598,31 @@ def select_optdeps(widget, pkg, optdeps):
for long_string in optdeps:
transaction.choose_list.append([False, long_string])
transaction.ChooseDialog.run()
if transaction.to_add:
ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True)
def install_with_optdeps(widget, pkg, optdeps):
select_optdeps(widget, pkg, optdeps)
transaction.to_add.add(pkg.name)
ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True)
def mark_explicitly_installed(widget, pkg):
error = transaction.SetPkgReason(pkg.name, pyalpm.PKG_REASON_EXPLICIT)
if error:
handle_error(error)
transaction.get_handle()
global search_dict
global groups_dict
global states_dict
global repos_dict
search_dict = {}
groups_dict = {}
states_dict = {}
repos_dict = {}
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
def on_list_treeview_button_press_event(treeview, event):
global right_click_menu
@ -620,6 +667,10 @@ def on_list_treeview_button_press_event(treeview, event):
item.set_always_show_image(True)
item.connect('activate', select_optdeps, liststore[treeiter][0], available_optdeps)
right_click_menu.append(item)
if liststore[treeiter][0].reason == pyalpm.PKG_REASON_DEPEND:
item = Gtk.MenuItem(_('Mark as explicitly installed'))
item.connect('activate', mark_explicitly_installed, liststore[treeiter][0])
right_click_menu.append(item)
else:
item = Gtk.ImageMenuItem(_('Install'))
item.set_image(Gtk.Image.new_from_pixbuf(to_install_icon))
@ -731,6 +782,12 @@ def on_list_treeview_row_activated(treeview, treeiter, column):
transaction.to_build.append(liststore[treeiter][0])
else:
transaction.to_add.add(liststore[treeiter][0].name)
if transaction.to_add or transaction.to_remove or transaction.to_build:
ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True)
elif not transaction.to_add and not transaction.to_remove and not transaction.to_build:
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
while Gtk.events_pending():
Gtk.main_iteration()
@ -753,7 +810,7 @@ def on_notebook1_switch_page(notebook, page, page_num):
elif page_num == 3:
on_repos_treeview_selection_changed(None)
def on_manager_valid_button_clicked(*args):
def on_ManagerValidButton_clicked(*args):
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
@ -762,12 +819,14 @@ def on_manager_valid_button_clicked(*args):
if error:
handle_error(error)
def on_manager_cancel_button_clicked(*args):
def on_ManagerCancelButton_clicked(*args):
transaction.to_add.clear()
transaction.to_remove.clear()
transaction.to_update.clear()
transaction.to_load.clear()
transaction.to_build.clear()
ManagerValidButton.set_sensitive(False)
ManagerCancelButton.set_sensitive(False)
if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1]))
@ -906,8 +965,8 @@ signals = {'on_ManagerWindow_delete_event' : on_ManagerWindow_delete_event,
'on_repos_treeview_selection_changed' : on_repos_treeview_selection_changed,
'on_list_treeview_row_activated' : on_list_treeview_row_activated,
'on_notebook1_switch_page' : on_notebook1_switch_page,
'on_manager_valid_button_clicked' : on_manager_valid_button_clicked,
'on_manager_cancel_button_clicked' : on_manager_cancel_button_clicked,
'on_ManagerCancelButton_clicked' : on_ManagerCancelButton_clicked,
'on_ManagerValidButton_clicked' : on_ManagerValidButton_clicked,
'on_refresh_item_activate' : on_refresh_item_activate,
'on_history_item_activate' : on_history_item_activate,
'on_history_textview_size_allocate' : on_history_textview_size_allocate,

102
pamac.pot
View File

@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: pamac 0.9.7\n"
"Project-Id-Version: pamac 0.9\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-03-30 15:09+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@ -130,178 +130,182 @@ msgstr ""
msgid "Downloading {pkgname}"
msgstr ""
#: pamac-daemon.py:561 pamac-install.py:127
#: pamac-daemon.py:427 pamac-daemon.py:439 pamac-daemon.py:759
#: pamac-daemon.py:767 pamac-daemon.py:790 pamac-daemon.py:824
msgid "Authentication failed"
msgstr ""
#: pamac-daemon.py:569 pamac-install.py:127
#, python-brace-format
msgid "{pkgname} is not a valid path or package name"
msgstr ""
#: pamac-daemon.py:674
#: pamac-daemon.py:682
#, python-brace-format
msgid ""
"The transaction cannot be performed because it needs to remove {pkgname1} "
"which is a locked package"
msgstr ""
#: pamac-daemon.py:684 pamac/transaction.py:449
#: pamac-daemon.py:692 pamac/transaction.py:449
msgid "Nothing to do"
msgstr ""
#: pamac-daemon.py:746
#: pamac-daemon.py:754
msgid "Transaction successfully finished"
msgstr ""
#: pamac-daemon.py:751 pamac-daemon.py:759 pamac-daemon.py:782
#: pamac-daemon.py:816
msgid "Authentication failed"
msgstr ""
#: pamac-manager.py:100 pamac-manager.py:131 pamac-manager.py:132
#: pamac-manager.py:147 pamac-manager.py:156 pamac-manager.py:177
#: pamac-manager.py:302 pamac-manager.py:590 pamac-manager.py:650
#: pamac-manager.py:720
#: pamac-manager.py:104 pamac-manager.py:135 pamac-manager.py:136
#: pamac-manager.py:151 pamac-manager.py:160 pamac-manager.py:181
#: pamac-manager.py:306 pamac-manager.py:637 pamac-manager.py:701
#: pamac-manager.py:771
msgid "No package found"
msgstr ""
#: pamac-manager.py:201 pamac-manager.py:263
#: pamac-manager.py:205 pamac-manager.py:267
msgid "local"
msgstr ""
#: pamac-manager.py:205 pamac-manager.py:246 pamac-manager.py:360
#: pamac-manager.py:209 pamac-manager.py:250 pamac-manager.py:372
msgid "Installed"
msgstr ""
#: pamac-manager.py:205 pamac-manager.py:249
#: pamac-manager.py:209 pamac-manager.py:253
msgid "Uninstalled"
msgstr ""
#: pamac-manager.py:205 pamac-manager.py:252
#: pamac-manager.py:209 pamac-manager.py:256
msgid "Orphans"
msgstr ""
#: pamac-manager.py:205 pamac-manager.py:224 pamac/transaction.py:757
#: pamac-manager.py:209 pamac-manager.py:228 pamac/transaction.py:757
msgid "To install"
msgstr ""
#: pamac-manager.py:205 pamac-manager.py:235 pamac/transaction.py:737
#: pamac-manager.py:209 pamac-manager.py:239 pamac/transaction.py:737
msgid "To remove"
msgstr ""
#: pamac-manager.py:350
#: pamac-manager.py:362
msgid "Licenses"
msgstr ""
#: pamac-manager.py:355
#: pamac-manager.py:367
msgid "Depends On"
msgstr ""
#: pamac-manager.py:363
#: pamac-manager.py:375
msgid "Optional Deps"
msgstr ""
#: pamac-manager.py:366
#: pamac-manager.py:378
msgid "Required By"
msgstr ""
#: pamac-manager.py:368
#: pamac-manager.py:380
msgid "Provides"
msgstr ""
#: pamac-manager.py:370
#: pamac-manager.py:382
msgid "Replaces"
msgstr ""
#: pamac-manager.py:372
#: pamac-manager.py:384
msgid "Conflicts With"
msgstr ""
#: pamac-manager.py:377
#: pamac-manager.py:389
msgid "Repository"
msgstr ""
#: pamac-manager.py:379 gui/manager.ui:544
#: pamac-manager.py:391 gui/manager.ui:544
msgid "Groups"
msgstr ""
#: pamac-manager.py:381
#: pamac-manager.py:393
msgid "Compressed Size"
msgstr ""
#: pamac-manager.py:382
#: pamac-manager.py:394
msgid "Download Size"
msgstr ""
#: pamac-manager.py:384
#: pamac-manager.py:396
msgid "Installed Size"
msgstr ""
#: pamac-manager.py:385
#: pamac-manager.py:397
msgid "Packager"
msgstr ""
#: pamac-manager.py:386
#: pamac-manager.py:398
msgid "Architecture"
msgstr ""
#: pamac-manager.py:389
#: pamac-manager.py:401
msgid "Install Date"
msgstr ""
#: pamac-manager.py:391
#: pamac-manager.py:403
msgid "Explicitly installed"
msgstr ""
#: pamac-manager.py:393
#: pamac-manager.py:405
msgid "Installed as a dependency for another package"
msgstr ""
#: pamac-manager.py:395
#: pamac-manager.py:407
msgid "Unknown"
msgstr ""
#: pamac-manager.py:396
#: pamac-manager.py:408
msgid "Install Reason"
msgstr ""
#: pamac-manager.py:401
#: pamac-manager.py:413
msgid "Signatures"
msgstr ""
#: pamac-manager.py:405
#: pamac-manager.py:417
msgid "Backup files"
msgstr ""
#: pamac-manager.py:570
#: pamac-manager.py:596
#, python-brace-format
msgid ""
"{pkgname} has {number} uninstalled optional deps.\n"
"Please choose those you would like to install:"
msgstr ""
#: pamac-manager.py:593
#: pamac-manager.py:640
msgid "Deselect"
msgstr ""
#: pamac-manager.py:599
#: pamac-manager.py:646
msgid "Remove"
msgstr ""
#: pamac-manager.py:606
#: pamac-manager.py:653
msgid "Reinstall"
msgstr ""
#: pamac-manager.py:618
#: pamac-manager.py:665
msgid "Install optional deps"
msgstr ""
#: pamac-manager.py:624
#: pamac-manager.py:671
msgid "Mark as explicitly installed"
msgstr ""
#: pamac-manager.py:675
msgid "Install"
msgstr ""
#: pamac-manager.py:636
#: pamac-manager.py:687
msgid "Install with optional deps"
msgstr ""
#: pamac-manager.py:936 pamac-updater.py:213 pamac-install.py:160
#: pamac-manager.py:995 pamac-updater.py:214 pamac-install.py:160
msgid "Pamac is already running"
msgstr ""