Commit 2c3b6628 authored by legton's avatar legton

Merge branch 'issue/582' into 'develop'

SCRUM#582: Disable autoupdate controls when disabled and organize object IDs

See merge request !75
parents bb66bb44 bcbe2360
Pipeline #18795 passed with stages
in 6 minutes and 28 seconds
le-control-panel (1.0.8) unstable; urgency=medium
* Disable autoupdate controls when disabled and organize object IDs (Closes: #582)
-- Guilherme Becker Agge <lesuporte@c3sl.ufpr.br> Fri, 07 Dec 2018 09:37:18 -0200
le-control-panel (1.0.7) unstable; urgency=medium le-control-panel (1.0.7) unstable; urgency=medium
* Change control panel error messages regarding the family-shield * Change control panel error messages regarding the family-shield
......
...@@ -110,11 +110,21 @@ class Handler: ...@@ -110,11 +110,21 @@ class Handler:
"/etc/apt/apt.conf.d/20auto-upgrades") "/etc/apt/apt.conf.d/20auto-upgrades")
os.system("sed -i s/\\\"0\\\"/\\\"1\\\"/ " os.system("sed -i s/\\\"0\\\"/\\\"1\\\"/ "
"/etc/apt/apt.conf.d/99le6-auto-upgrade.conf") "/etc/apt/apt.conf.d/99le6-auto-upgrade.conf")
# Ativa a parte de configuração do autoupdate
builder.get_object("iconAutoUpdateStatus").set_sensitive(True)
builder.get_object("spinHour").set_sensitive(True)
builder.get_object("spinMinute").set_sensitive(True)
builder.get_object("applyUpdateButton").set_sensitive(True)
else: else:
os.system("sed -i s/\\\"1\\\"/\\\"0\\\"/ " os.system("sed -i s/\\\"1\\\"/\\\"0\\\"/ "
"/etc/apt/apt.conf.d/20auto-upgrades") "/etc/apt/apt.conf.d/20auto-upgrades")
os.system("sed -i s/\\\"1\\\"/\\\"0\\\"/ " os.system("sed -i s/\\\"1\\\"/\\\"0\\\"/ "
"/etc/apt/apt.conf.d/99le6-auto-upgrade.conf") "/etc/apt/apt.conf.d/99le6-auto-upgrade.conf")
# Desativa a parte de configuração do autoupdate
builder.get_object("iconAutoUpdateStatus").set_sensitive(False)
builder.get_object("spinHour").set_sensitive(False)
builder.get_object("spinMinute").set_sensitive(False)
builder.get_object("applyUpdateButton").set_sensitive(False)
return True return True
def onEpoptesButtonPressed(self, button): def onEpoptesButtonPressed(self, button):
...@@ -146,8 +156,8 @@ class Handler: ...@@ -146,8 +156,8 @@ class Handler:
messageDialog.connect("response", self.rebootMessageResponse) messageDialog.connect("response", self.rebootMessageResponse)
messageDialog.run() messageDialog.run()
messageDialog.destroy() messageDialog.destroy()
builder.get_object("multiterminal_reboot_label").show() builder.get_object("labelMultiterminalReboot").show()
builder.get_object("multiterminalButton").hide() builder.get_object("buttonMultiterminal").hide()
except Exception as e: except Exception as e:
print(e) print(e)
pass pass
...@@ -236,9 +246,9 @@ class Handler: ...@@ -236,9 +246,9 @@ class Handler:
def timeout(): def timeout():
iconEpoptesStatus = builder.get_object("epoptesstatusicon") iconEpoptesStatus = builder.get_object("iconEpoptesStatus")
boxEpoptesStatus = builder.get_object("boxepoptesstatus") boxEpoptesStatus = builder.get_object("boxEpoptesStatus")
labelEpoptesStatus = builder.get_object("labelepoptesstatus") labelEpoptesStatus = builder.get_object("labelEpoptesStatus")
if (statusEpoptes(labelEpoptesStatus) == 2): if (statusEpoptes(labelEpoptesStatus) == 2):
iconEpoptesStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU) iconEpoptesStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU)
boxEpoptesStatus.set_tooltip_text("O Epoptes está ativo") boxEpoptesStatus.set_tooltip_text("O Epoptes está ativo")
...@@ -260,9 +270,9 @@ def handler(signum, frame): ...@@ -260,9 +270,9 @@ def handler(signum, frame):
labelEdubarStorage.set_label(getEdubarStorage()) labelEdubarStorage.set_label(getEdubarStorage())
# lcpmonitor detected changes at unattended-upgrades # lcpmonitor detected changes at unattended-upgrades
elif signum == 35: elif signum == 35:
iconAutoUpdateStatus = builder.get_object("autoupdatestatusicon") iconAutoUpdateStatus = builder.get_object("iconAutoUpdateStatus")
boxAutoUpdateStatus = builder.get_object("boxautoupdatestatus") boxAutoUpdateStatus = builder.get_object("boxAutoupdateStatus")
labelAutoUpdateStatus = builder.get_object("labelautoupdatestatus") labelAutoUpdateStatus = builder.get_object("labelAutoupdateStatus")
if (statusAutoUpdate(labelAutoUpdateStatus)): if (statusAutoUpdate(labelAutoUpdateStatus)):
iconAutoUpdateStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU) iconAutoUpdateStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU)
boxAutoUpdateStatus.set_tooltip_text("Os pacotes estão em " boxAutoUpdateStatus.set_tooltip_text("Os pacotes estão em "
...@@ -540,7 +550,7 @@ def getShieldLocalState(): ...@@ -540,7 +550,7 @@ def getShieldLocalState():
try: try:
output, err = runShellCommand("family-shield --status") output, err = runShellCommand("family-shield --status")
if len(err) > 0: if len(err) > 0:
builder.get_object("family_shield_frame").set_sensitive(False) builder.get_object("frameFamilyShield").set_sensitive(False)
return False return False
if output.find("enabled") != -1: if output.find("enabled") != -1:
return True return True
...@@ -548,7 +558,7 @@ def getShieldLocalState(): ...@@ -548,7 +558,7 @@ def getShieldLocalState():
return False return False
except Exception as e: except Exception as e:
print(e) print(e)
builder.get_object("family_shield_frame").set_sensitive(False) builder.get_object("frameFamilyShield").set_sensitive(False)
return False return False
...@@ -572,7 +582,7 @@ def getShieldNetworkState(): ...@@ -572,7 +582,7 @@ def getShieldNetworkState():
return current_state return current_state
except Exception as e: except Exception as e:
print(e) print(e)
builder.get_object("family_shield_frame").set_sensitive(False) builder.get_object("frameFamilyShield").set_sensitive(False)
return current_state return current_state
...@@ -625,13 +635,13 @@ def usingMultiterminal(): ...@@ -625,13 +635,13 @@ def usingMultiterminal():
def setPermissions(uid): def setPermissions(uid):
groups = [grp.getgrgid(g).gr_name for g in os.getgroups()] groups = [grp.getgrgid(g).gr_name for g in os.getgroups()]
familyShield = builder.get_object("family_shield_frame") familyShield = builder.get_object("frameFamilyShield")
autoUpdate = builder.get_object("autoupdate_frame") autoUpdate = builder.get_object("frameAutoUpdate")
epoptes = builder.get_object("epoptes_frame") epoptes = builder.get_object("frameEpoptes")
epoptesSwitch = builder.get_object("switchEpoptes") epoptesSwitch = builder.get_object("switchEpoptes")
users = builder.get_object("new_user_frame") users = builder.get_object("frameNewUser")
multiterminal = builder.get_object("multiterminal_frame") multiterminal = builder.get_object("frameMultiterminal")
unlock = builder.get_object("unlock_button") unlock = builder.get_object("buttonUnlock")
allGroups = [] allGroups = []
with open("/etc/group", "r") as f: with open("/etc/group", "r") as f:
...@@ -664,10 +674,10 @@ def setPermissions(uid): ...@@ -664,10 +674,10 @@ def setPermissions(uid):
def configureMultiterminal(): def configureMultiterminal():
if not usingMultiterminal(): if not usingMultiterminal():
multiterminal_frame = builder.get_object("multiterminal_frame") multiterminal_frame = builder.get_object("frameMultiterminal")
multiterminal_separator = builder.get_object("multiterminal_separator") separatorMultiterminal = builder.get_object("separatorMultiterminal")
multiterminal_frame.hide() multiterminal_frame.hide()
multiterminal_separator.hide() separatorMultiterminal.hide()
else: else:
if os.path.isfile("/etc/le-multiterminal/configurado"): if os.path.isfile("/etc/le-multiterminal/configurado"):
widget_to_hide = builder.get_object("multiterminal_reboot_label") widget_to_hide = builder.get_object("multiterminal_reboot_label")
...@@ -732,9 +742,9 @@ if __name__ == "__main__": ...@@ -732,9 +742,9 @@ if __name__ == "__main__":
labelEdubarStorage = builder.get_object("labelArmazenamentoEdubar") labelEdubarStorage = builder.get_object("labelArmazenamentoEdubar")
labelEdubarStorage.set_label(getEdubarStorage()) labelEdubarStorage.set_label(getEdubarStorage())
iconEpoptesStatus = builder.get_object("epoptesstatusicon") iconEpoptesStatus = builder.get_object("iconEpoptesStatus")
boxEpoptesStatus = builder.get_object("boxepoptesstatus") boxEpoptesStatus = builder.get_object("boxEpoptesStatus")
labelEpoptesStatus = builder.get_object("labelepoptesstatus") labelEpoptesStatus = builder.get_object("labelEpoptesStatus")
if (statusEpoptes(labelEpoptesStatus) == 2): if (statusEpoptes(labelEpoptesStatus) == 2):
iconEpoptesStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU) iconEpoptesStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU)
boxEpoptesStatus.set_tooltip_text("O Epoptes está ativo") boxEpoptesStatus.set_tooltip_text("O Epoptes está ativo")
...@@ -744,15 +754,15 @@ if __name__ == "__main__": ...@@ -744,15 +754,15 @@ if __name__ == "__main__":
switchShield = builder.get_object("familyShield") switchShield = builder.get_object("familyShield")
newUserButton = builder.get_object("newUserButton") newUserButton = builder.get_object("buttonNewUser")
newUserDialog = builder.get_object("newUserDialog") newUserDialog = builder.get_object("dialogNewUser")
newUserButton.connect("clicked", onNewUserButtonPressed, newUserDialog) newUserButton.connect("clicked", onNewUserButtonPressed, newUserDialog)
switchUpdate = builder.get_object("switchAutoUpdate") switchUpdate = builder.get_object("switchAutoUpdate")
switchEpoptes = builder.get_object("switchEpoptes") switchEpoptes = builder.get_object("switchEpoptes")
SpinHour = builder.get_object("incrementa_hora") SpinHour = builder.get_object("spinHour")
SpinMin = builder.get_object("incrementa_minuto") SpinMin = builder.get_object("spinMinute")
# uid = os.getuid() # uid = os.getuid()
setPermissions(uid) setPermissions(uid)
...@@ -761,7 +771,7 @@ if __name__ == "__main__": ...@@ -761,7 +771,7 @@ if __name__ == "__main__":
signal.signal(34, handler) signal.signal(34, handler)
signal.signal(35, handler) signal.signal(35, handler)
window = builder.get_object("mainwindow") window = builder.get_object("mainWindow")
window.show_all() window.show_all()
configureMultiterminal() configureMultiterminal()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment