move refresh button and do not auto-refresh at manager startup

This commit is contained in:
guinux 2014-02-12 16:06:15 +01:00
parent ce11d7ac3b
commit e032dfa8f0
5 changed files with 83 additions and 34 deletions

View File

@ -7,7 +7,9 @@
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property> <property name="modal">True</property>
<property name="window_position">center-on-parent</property> <property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="urgency_hint">True</property>
<property name="has_resize_grip">False</property> <property name="has_resize_grip">False</property>
<property name="message_type">error</property> <property name="message_type">error</property>
<property name="buttons">ok</property> <property name="buttons">ok</property>
@ -38,7 +40,10 @@
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property> <property name="modal">True</property>
<property name="window_position">center-on-parent</property> <property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="urgency_hint">True</property>
<property name="has_resize_grip">False</property>
<property name="buttons">ok</property> <property name="buttons">ok</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox9"> <object class="GtkBox" id="messagedialog-vbox9">
@ -214,8 +219,12 @@
<object class="GtkMessageDialog" id="QuestionDialog"> <object class="GtkMessageDialog" id="QuestionDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property> <property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="urgency_hint">True</property>
<property name="has_resize_grip">False</property>
<property name="message_type">question</property> <property name="message_type">question</property>
<property name="buttons">yes-no</property> <property name="buttons">yes-no</property>
<child internal-child="vbox"> <child internal-child="vbox">
@ -242,8 +251,11 @@
<object class="GtkMessageDialog" id="WarningDialog"> <object class="GtkMessageDialog" id="WarningDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property> <property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="urgency_hint">True</property>
<property name="has_resize_grip">False</property>
<property name="message_type">warning</property> <property name="message_type">warning</property>
<property name="buttons">ok</property> <property name="buttons">ok</property>
<child internal-child="vbox"> <child internal-child="vbox">

View File

@ -128,6 +128,12 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkImage" id="file_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
</object>
<object class="GtkListStore" id="files_list"> <object class="GtkListStore" id="files_list">
<columns> <columns>
<!-- column-name file --> <!-- column-name file -->
@ -140,12 +146,6 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
</object>
<object class="GtkImage" id="local_icon"> <object class="GtkImage" id="local_icon">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -155,22 +155,12 @@
<object class="GtkMenu" id="main_menu"> <object class="GtkMenu" id="main_menu">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="refresh_item">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_refresh_item_activate" swapped="no"/>
</object>
</child>
<child> <child>
<object class="GtkImageMenuItem" id="history_item"> <object class="GtkImageMenuItem" id="history_item">
<property name="label" translatable="yes">View History</property> <property name="label" translatable="yes">View History</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="image">image1</property> <property name="image">file_icon</property>
<property name="use_stock">False</property> <property name="use_stock">False</property>
<signal name="activate" handler="on_history_item_activate" swapped="no"/> <signal name="activate" handler="on_history_item_activate" swapped="no"/>
</object> </object>
@ -300,6 +290,11 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkImage" id="refresh_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-refresh</property>
</object>
<object class="GtkListStore" id="repos_list"> <object class="GtkListStore" id="repos_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name name -->
@ -341,6 +336,24 @@
<object class="GtkBox" id="box4"> <object class="GtkBox" id="box4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child>
<object class="GtkButton" id="ManagerRefreshButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Refresh</property>
<property name="image">refresh_icon</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_ManagerRefreshButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="ManagerValidButton"> <object class="GtkButton" id="ManagerValidButton">
<property name="visible">True</property> <property name="visible">True</property>
@ -356,7 +369,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -374,7 +387,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -392,7 +405,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -335,14 +335,14 @@ class PamacDBusService(dbus.service.Object):
if not (level & _logmask): if not (level & _logmask):
return return
if level & pyalpm.LOG_ERROR: if level & pyalpm.LOG_ERROR:
self.EmitLogError(line) #self.EmitLogError(line)
_error = "ERROR: "+line _error = _('Error: ')+line
self.EmitActionLong(_error) self.EmitActionLong(_error)
self.EmitNeedDetails(True) self.EmitNeedDetails(True)
print(line) print(line)
elif level & pyalpm.LOG_WARNING: elif level & pyalpm.LOG_WARNING:
self.warning += line self.warning += line
_warning = "WARNING: "+line _warning = _('WARNING: ')+line
self.EmitActionLong(_warning) self.EmitActionLong(_warning)
elif level & pyalpm.LOG_DEBUG: elif level & pyalpm.LOG_DEBUG:
line = "DEBUG: " + line line = "DEBUG: " + line
@ -549,6 +549,9 @@ class PamacDBusService(dbus.service.Object):
error = '' error = ''
try: try:
for db in self.syncdbs: for db in self.syncdbs:
# this is a security, in case of virtual package it will
# choose the first provider, the choice should have been
# done by the client
pkg = pyalpm.find_satisfier(db.pkgcache, pkgname) pkg = pyalpm.find_satisfier(db.pkgcache, pkgname)
if pkg: if pkg:
self.t.add_pkg(pkg) self.t.add_pkg(pkg)

View File

@ -424,7 +424,6 @@ def set_files_list(pkg):
def handle_error(error): def handle_error(error):
ManagerWindow.get_window().set_cursor(None) ManagerWindow.get_window().set_cursor(None)
transaction.ProgressWindow.hide()
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
if error: if error:
@ -434,6 +433,7 @@ def handle_error(error):
response = transaction.ErrorDialog.run() response = transaction.ErrorDialog.run()
if response: if response:
transaction.ErrorDialog.hide() transaction.ErrorDialog.hide()
transaction.ProgressWindow.hide()
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter()) transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.Release() transaction.Release()
transaction.get_handle() transaction.get_handle()
@ -491,7 +491,7 @@ def reload_config(msg):
if config.enable_aur == False: if config.enable_aur == False:
search_aur_button.set_active(False) search_aur_button.set_active(False)
search_aur_button.set_visible(config.enable_aur) search_aur_button.set_visible(config.enable_aur)
transaction.get_updates() #transaction.get_updates()
def on_ManagerWindow_delete_event(*args): def on_ManagerWindow_delete_event(*args):
transaction.StopDaemon() transaction.StopDaemon()
@ -524,11 +524,13 @@ def on_TransCancelButton_clicked(*args):
def on_ProgressCloseButton_clicked(*args): def on_ProgressCloseButton_clicked(*args):
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter()) transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.need_details_handler(False) transaction.need_details_handler(False)
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
Gtk.main_iteration()
transaction.to_build.clear() transaction.to_build.clear()
transaction.get_updates() #ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
#while Gtk.events_pending():
#Gtk.main_iteration()
#transaction.get_updates()
ManagerWindow.get_window().set_cursor(None)
transaction.ProgressWindow.hide()
def on_ProgressCancelButton_clicked(*args): def on_ProgressCancelButton_clicked(*args):
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
@ -597,6 +599,25 @@ def select_optdeps(widget, pkg, optdeps):
for long_string in optdeps: for long_string in optdeps:
transaction.choose_list.append([False, long_string]) transaction.choose_list.append([False, long_string])
transaction.ChooseDialog.run() transaction.ChooseDialog.run()
# some optdep can be virtual package so check for providers
for name in transaction.to_add:
if not transaction.get_syncpkg(name):
transaction.to_add.discard(name)
# if a provider is already installed, do nothing
if pyalpm.find_satisfier(transaction.localdb.pkgcache, name):
continue
providers = set()
for db in transaction.syncdbs:
pkgs = db.pkgcache
provider = pyalpm.find_satisfier(pkgs, name)
while provider:
providers.add(provider.name)
for pkg in pkgs:
if pkg.name == provider.name:
pkgs.remove(pkg)
break
provider = pyalpm.find_satisfier(pkgs, name)
transaction.choose_provides((providers, name))
if transaction.to_add: if transaction.to_add:
ManagerValidButton.set_sensitive(True) ManagerValidButton.set_sensitive(True)
ManagerCancelButton.set_sensitive(True) ManagerCancelButton.set_sensitive(True)
@ -823,7 +844,7 @@ def on_ManagerCancelButton_clicked(*args):
if current_filter[0]: if current_filter[0]:
refresh_packages_list(current_filter[0](current_filter[1])) refresh_packages_list(current_filter[0](current_filter[1]))
def on_refresh_item_activate(*args): def on_ManagerRefreshButton_clicked(*args):
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
@ -960,7 +981,7 @@ signals = {'on_ManagerWindow_delete_event' : on_ManagerWindow_delete_event,
'on_notebook1_switch_page' : on_notebook1_switch_page, 'on_notebook1_switch_page' : on_notebook1_switch_page,
'on_ManagerCancelButton_clicked' : on_ManagerCancelButton_clicked, 'on_ManagerCancelButton_clicked' : on_ManagerCancelButton_clicked,
'on_ManagerValidButton_clicked' : on_ManagerValidButton_clicked, 'on_ManagerValidButton_clicked' : on_ManagerValidButton_clicked,
'on_refresh_item_activate' : on_refresh_item_activate, 'on_ManagerRefreshButton_clicked' : on_ManagerRefreshButton_clicked,
'on_history_item_activate' : on_history_item_activate, 'on_history_item_activate' : on_history_item_activate,
'on_history_textview_size_allocate' : on_history_textview_size_allocate, 'on_history_textview_size_allocate' : on_history_textview_size_allocate,
'on_HistoryCloseButton_clicked' : on_HistoryCloseButton_clicked, 'on_HistoryCloseButton_clicked' : on_HistoryCloseButton_clicked,
@ -1003,8 +1024,8 @@ else:
transaction.get_handle() transaction.get_handle()
update_lists() update_lists()
ManagerWindow.show() ManagerWindow.show()
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) #ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
transaction.refresh() #transaction.refresh()
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
Gtk.main() Gtk.main()

View File

@ -80,7 +80,6 @@ def have_updates():
def handle_error(error): def handle_error(error):
UpdaterWindow.get_window().set_cursor(None) UpdaterWindow.get_window().set_cursor(None)
transaction.ProgressWindow.hide()
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
if error: if error:
@ -90,6 +89,7 @@ def handle_error(error):
response = transaction.ErrorDialog.run() response = transaction.ErrorDialog.run()
if response: if response:
transaction.ErrorDialog.hide() transaction.ErrorDialog.hide()
transaction.ProgressWindow.hide()
transaction.get_handle() transaction.get_handle()
transaction.mark_needed_pkgs_as_dep() transaction.mark_needed_pkgs_as_dep()