[sulfur] make possible to load multiple instances showing warnings and disabling widgets
This commit is contained in:
@@ -67,11 +67,12 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.Cacher = EntropyCacher()
|
||||
|
||||
self.do_debug = False
|
||||
self._RESOURCES_LOCKED = False
|
||||
locked = self.Equo.application_lock_check(silent = True)
|
||||
if locked:
|
||||
self._RESOURCES_LOCKED = True
|
||||
okDialog( None,
|
||||
_("Entropy resources are locked and not accessible. Another Entropy application is running. Sorry, can't load Sulfur.") )
|
||||
raise SystemExit(1)
|
||||
_("Another Entropy instance is running. You won't be able to install/remove/sync applications.") )
|
||||
self.safe_mode_txt = ''
|
||||
# check if we'are running in safe mode
|
||||
if self.Equo.safe_mode:
|
||||
@@ -332,6 +333,13 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
# can lead to sqlite3 db corruptions?
|
||||
self.setup_background_cache_generators()
|
||||
|
||||
def setup_resources_locked(self):
|
||||
self.ui.repoRefreshButton.set_sensitive(not self._RESOURCES_LOCKED)
|
||||
self.ui.queueTabBox.set_sensitive(not self._RESOURCES_LOCKED)
|
||||
self.ui.reposVbox.set_sensitive(not self._RESOURCES_LOCKED)
|
||||
self.ui.installPackageItem.set_sensitive(not self._RESOURCES_LOCKED)
|
||||
self.ui.systemVbox.set_sensitive(not self._RESOURCES_LOCKED)
|
||||
|
||||
def setup_labels(self):
|
||||
|
||||
# make Sulfur label look nicer
|
||||
@@ -339,6 +347,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
_("Applications"),))
|
||||
self.ui.rbSyncSimpleLabel.set_markup("<small>%s</small>" % (
|
||||
_("Sync"),))
|
||||
self.ui.rbQueueSimpleLabel.set_markup("<small>%s</small>" % (
|
||||
_("Actions"),))
|
||||
|
||||
small_widgets = [self.ui.rbRefreshLabel, self.ui.rbUpdatesLabel,
|
||||
self.ui.rbAvailableLabel, self.ui.rbInstalledLabel,
|
||||
@@ -395,6 +405,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.ui.advancedMode.set_active(1)
|
||||
SulfurConf.simple_mode = do_simple
|
||||
SulfurConf.save()
|
||||
self.setup_resources_locked()
|
||||
|
||||
def switch_simple_mode(self):
|
||||
self.ui.servicesMenuItem.hide()
|
||||
@@ -425,6 +436,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.ui.rbUpdatesSimpleHbox.reorder_child(adv_content, 0)
|
||||
|
||||
self.ui.rbSyncSimpleLabel.show()
|
||||
self.ui.rbQueueSimpleLabel.show()
|
||||
self.ui.rbUpdatesSimpleLabel.show()
|
||||
self.ui.rbUpdatesLabel.hide()
|
||||
self.ui.rbAllSimpleLabel.show()
|
||||
@@ -467,6 +479,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.ui.headerHbox.reorder_child(adv_content, 0)
|
||||
|
||||
self.ui.rbSyncSimpleLabel.hide()
|
||||
self.ui.rbQueueSimpleLabel.hide()
|
||||
self.ui.rbUpdatesSimpleLabel.hide()
|
||||
self.ui.rbUpdatesLabel.show()
|
||||
self.ui.rbAllSimpleLabel.hide()
|
||||
@@ -1296,6 +1309,9 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
|
||||
def update_repositories(self, repos):
|
||||
|
||||
if self._RESOURCES_LOCKED:
|
||||
return False
|
||||
|
||||
force = self.ui.forceRepoUpdate.get_active()
|
||||
|
||||
try:
|
||||
@@ -1738,6 +1754,11 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
download_sources = False, direct_remove_matches = None,
|
||||
direct_install_matches = None):
|
||||
|
||||
if self._RESOURCES_LOCKED:
|
||||
okDialog(self.ui.main,
|
||||
_("Another Entropy instance is running. Cannot process queue."))
|
||||
return False
|
||||
|
||||
if remove_repos is None:
|
||||
remove_repos = []
|
||||
if direct_remove_matches is None:
|
||||
|
||||
@@ -497,10 +497,27 @@
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="rbQueuedImage">
|
||||
<widget class="GtkHBox" id="hbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="rbQueuedImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="rbQueueSimpleLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
@@ -510,7 +527,7 @@
|
||||
<widget class="GtkLabel" id="rbPkgSetsLabel1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Queue</property>
|
||||
<property name="label" translatable="yes">Actions</property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@@ -5257,15 +5274,6 @@ Relaxed</property>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
||||
Reference in New Issue
Block a user