Skip to content

Commit

Permalink
fix: update pages to add/remove switches for new/removed components, …
Browse files Browse the repository at this point in the history
…where applicable
  • Loading branch information
isantop authored and jackpot51 committed Oct 21, 2020
1 parent 7755da2 commit c3594d8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
22 changes: 14 additions & 8 deletions repoman/settings.py
Expand Up @@ -318,6 +318,7 @@ def get_new_switch(self, component, description=None):
switch.toggle = toggle
switch.add(toggle)

switch.show_all()
return switch

def create_switches(self):
Expand All @@ -331,6 +332,7 @@ def create_switches(self):
'state-set',
self.on_component_toggled
)
switch.show()
self.checks_grid.add(switch)

if self.system_repo:
Expand All @@ -345,6 +347,7 @@ def create_switches(self):
'state-set',
self.on_component_toggled
)
switch.show()
self.checks_grid.add(switch)

def set_child_checks_sensitive(self):
Expand Down Expand Up @@ -373,14 +376,18 @@ def show_proposed(self):

def show_distro(self):
self.system_repo.load_from_file()
self.create_switches()
self.block_handlers()
for comp in self.checks_grid.get_children():
if comp.component in self.system_repo.components:
self.log.debug('Component %s is enabled', comp.component)
comp.toggle.set_active(True)
else:
self.log.debug('Component %s is disabled', comp.component)
comp.toggle.set_active(False)
self.switches_sensitive = False
if self.system_repo:
self.switches_sensitive = True
for comp in self.checks_grid.get_children():
if comp.component in self.system_repo.components:
self.log.debug('Component %s is enabled', comp.component)
comp.toggle.set_active(True)
else:
self.log.debug('Component %s is disabled', comp.component)
comp.toggle.set_active(False)

self.unblock_handlers()

Expand All @@ -403,7 +410,6 @@ def on_proposed_check_toggled(self, switch, state):
def on_config_changed(self, monitor, file, other_file, event_type):
self.log.debug('Installation changed, regenerating list')
if self.system_repo:
self.switches_sensitive = True
self.show_distro()
self.show_source_code()
self.show_proposed()
Expand Down
10 changes: 7 additions & 3 deletions repoman/updates.py
Expand Up @@ -153,7 +153,7 @@ def create_switches(self):
self.on_suite_toggled
)
self.checks_grid.add(switch)
switch.show()
switch.show_all()

if self.system_repo:
for suite in self.system_repo.suites:
Expand All @@ -171,16 +171,20 @@ def create_switches(self):
self.on_suite_toggled
)
self.checks_grid.add(switch)
switch.show()
switch.show_all()

def show_updates(self):
""" Initialize the state of all of the switches. """
self.log.debug("init_distro")
self.system_repo.load_from_file()
self.create_switches()
self.block_handlers()

for suite in self.checks_grid.get_children():
if suite.suite in self.system_repo.suites:
suite.toggle.set_active(True)
else:
suite.toggle.set_active(False)

self.unblock_handlers()

Expand All @@ -195,5 +199,5 @@ def on_suite_toggled(self, switch, state):
def on_config_changed(self, monitor, file, other_file, event_type):
self.log.debug('Installation changed, regenerating list')
if self.system_repo:
self.set_suites_enabled(self.parent.setting.checks_enabled)
self.show_updates()
self.set_suites_enabled(self.parent.setting.checks_enabled)

0 comments on commit c3594d8

Please sign in to comment.