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
* Change control panel error messages regarding the family-shield
......
......@@ -110,11 +110,21 @@ class Handler:
"/etc/apt/apt.conf.d/20auto-upgrades")
os.system("sed -i s/\\\"0\\\"/\\\"1\\\"/ "
"/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:
os.system("sed -i s/\\\"1\\\"/\\\"0\\\"/ "
"/etc/apt/apt.conf.d/20auto-upgrades")
os.system("sed -i s/\\\"1\\\"/\\\"0\\\"/ "
"/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
def onEpoptesButtonPressed(self, button):
......@@ -146,8 +156,8 @@ class Handler:
messageDialog.connect("response", self.rebootMessageResponse)
messageDialog.run()
messageDialog.destroy()
builder.get_object("multiterminal_reboot_label").show()
builder.get_object("multiterminalButton").hide()
builder.get_object("labelMultiterminalReboot").show()
builder.get_object("buttonMultiterminal").hide()
except Exception as e:
print(e)
pass
......@@ -236,9 +246,9 @@ class Handler:
def timeout():
iconEpoptesStatus = builder.get_object("epoptesstatusicon")
boxEpoptesStatus = builder.get_object("boxepoptesstatus")
labelEpoptesStatus = builder.get_object("labelepoptesstatus")
iconEpoptesStatus = builder.get_object("iconEpoptesStatus")
boxEpoptesStatus = builder.get_object("boxEpoptesStatus")
labelEpoptesStatus = builder.get_object("labelEpoptesStatus")
if (statusEpoptes(labelEpoptesStatus) == 2):
iconEpoptesStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU)
boxEpoptesStatus.set_tooltip_text("O Epoptes está ativo")
......@@ -260,9 +270,9 @@ def handler(signum, frame):
labelEdubarStorage.set_label(getEdubarStorage())
# lcpmonitor detected changes at unattended-upgrades
elif signum == 35:
iconAutoUpdateStatus = builder.get_object("autoupdatestatusicon")
boxAutoUpdateStatus = builder.get_object("boxautoupdatestatus")
labelAutoUpdateStatus = builder.get_object("labelautoupdatestatus")
iconAutoUpdateStatus = builder.get_object("iconAutoUpdateStatus")
boxAutoUpdateStatus = builder.get_object("boxAutoupdateStatus")
labelAutoUpdateStatus = builder.get_object("labelAutoupdateStatus")
if (statusAutoUpdate(labelAutoUpdateStatus)):
iconAutoUpdateStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU)
boxAutoUpdateStatus.set_tooltip_text("Os pacotes estão em "
......@@ -540,7 +550,7 @@ def getShieldLocalState():
try:
output, err = runShellCommand("family-shield --status")
if len(err) > 0:
builder.get_object("family_shield_frame").set_sensitive(False)
builder.get_object("frameFamilyShield").set_sensitive(False)
return False
if output.find("enabled") != -1:
return True
......@@ -548,7 +558,7 @@ def getShieldLocalState():
return False
except Exception as e:
print(e)
builder.get_object("family_shield_frame").set_sensitive(False)
builder.get_object("frameFamilyShield").set_sensitive(False)
return False
......@@ -572,7 +582,7 @@ def getShieldNetworkState():
return current_state
except Exception as e:
print(e)
builder.get_object("family_shield_frame").set_sensitive(False)
builder.get_object("frameFamilyShield").set_sensitive(False)
return current_state
......@@ -625,13 +635,13 @@ def usingMultiterminal():
def setPermissions(uid):
groups = [grp.getgrgid(g).gr_name for g in os.getgroups()]
familyShield = builder.get_object("family_shield_frame")
autoUpdate = builder.get_object("autoupdate_frame")
epoptes = builder.get_object("epoptes_frame")
familyShield = builder.get_object("frameFamilyShield")
autoUpdate = builder.get_object("frameAutoUpdate")
epoptes = builder.get_object("frameEpoptes")
epoptesSwitch = builder.get_object("switchEpoptes")
users = builder.get_object("new_user_frame")
multiterminal = builder.get_object("multiterminal_frame")
unlock = builder.get_object("unlock_button")
users = builder.get_object("frameNewUser")
multiterminal = builder.get_object("frameMultiterminal")
unlock = builder.get_object("buttonUnlock")
allGroups = []
with open("/etc/group", "r") as f:
......@@ -664,10 +674,10 @@ def setPermissions(uid):
def configureMultiterminal():
if not usingMultiterminal():
multiterminal_frame = builder.get_object("multiterminal_frame")
multiterminal_separator = builder.get_object("multiterminal_separator")
multiterminal_frame = builder.get_object("frameMultiterminal")
separatorMultiterminal = builder.get_object("separatorMultiterminal")
multiterminal_frame.hide()
multiterminal_separator.hide()
separatorMultiterminal.hide()
else:
if os.path.isfile("/etc/le-multiterminal/configurado"):
widget_to_hide = builder.get_object("multiterminal_reboot_label")
......@@ -732,9 +742,9 @@ if __name__ == "__main__":
labelEdubarStorage = builder.get_object("labelArmazenamentoEdubar")
labelEdubarStorage.set_label(getEdubarStorage())
iconEpoptesStatus = builder.get_object("epoptesstatusicon")
boxEpoptesStatus = builder.get_object("boxepoptesstatus")
labelEpoptesStatus = builder.get_object("labelepoptesstatus")
iconEpoptesStatus = builder.get_object("iconEpoptesStatus")
boxEpoptesStatus = builder.get_object("boxEpoptesStatus")
labelEpoptesStatus = builder.get_object("labelEpoptesStatus")
if (statusEpoptes(labelEpoptesStatus) == 2):
iconEpoptesStatus.set_from_stock("gtk-yes", Gtk.IconSize.MENU)
boxEpoptesStatus.set_tooltip_text("O Epoptes está ativo")
......@@ -744,15 +754,15 @@ if __name__ == "__main__":
switchShield = builder.get_object("familyShield")
newUserButton = builder.get_object("newUserButton")
newUserDialog = builder.get_object("newUserDialog")
newUserButton = builder.get_object("buttonNewUser")
newUserDialog = builder.get_object("dialogNewUser")
newUserButton.connect("clicked", onNewUserButtonPressed, newUserDialog)
switchUpdate = builder.get_object("switchAutoUpdate")
switchEpoptes = builder.get_object("switchEpoptes")
SpinHour = builder.get_object("incrementa_hora")
SpinMin = builder.get_object("incrementa_minuto")
SpinHour = builder.get_object("spinHour")
SpinMin = builder.get_object("spinMinute")
# uid = os.getuid()
setPermissions(uid)
......@@ -761,7 +771,7 @@ if __name__ == "__main__":
signal.signal(34, handler)
signal.signal(35, handler)
window = builder.get_object("mainwindow")
window = builder.get_object("mainWindow")
window.show_all()
configureMultiterminal()
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkAdjustment" id="Hour_adjustment">
<property name="upper">23</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkMessageDialog" id="dialogWrongPassword">
<property name="can_focus">False</property>
<property name="modal">True</property>
......@@ -17,8 +12,11 @@
<property name="text" translatable="yes">Erro</property>
<property name="secondary_text" translatable="yes">A senha digitada está incorreta</property>
<signal name="response" handler="passErrorResponse" swapped="no"/>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<object class="GtkBox" id="boxError">
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
......@@ -27,7 +25,7 @@
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<object class="GtkButtonBox" id="buttonError">
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
......@@ -77,6 +75,11 @@
</row>
</data>
</object>
<object class="GtkAdjustment" id="hourAdjustment">
<property name="upper">23</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -92,16 +95,19 @@
<property name="can_focus">False</property>
<property name="pixbuf">usr/share/icons/hicolor/20x20/apps/le-help.png</property>
</object>
<object class="GtkAdjustment" id="minute_adjustment">
<object class="GtkAdjustment" id="minuteAdjustment">
<property name="upper">59</property>
<property name="step_increment">5</property>
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="mainwindow">
<object class="GtkWindow" id="mainWindow">
<property name="can_focus">False</property>
<signal name="destroy" handler="onDeleteWindow" swapped="no"/>
<child>
<object class="GtkScrolledWindow">
<placeholder/>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
......@@ -109,11 +115,11 @@
<property name="min_content_width">100</property>
<property name="min_content_height">610</property>
<child>
<object class="GtkViewport">
<object class="GtkViewport" id="viewPort">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="mainbox">
<object class="GtkBox" id="mainBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">10</property>
......@@ -124,7 +130,7 @@
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<child>
<object class="GtkButton" id="unlock_button">
<object class="GtkButton" id="buttonUnlock">
<property name="label" translatable="yes">Desbloquear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -159,7 +165,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="family_shield_frame">
<object class="GtkFrame" id="frameFamilyShield">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -260,7 +266,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="autoupdate_frame">
<object class="GtkFrame" id="frameAutoUpdate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -327,7 +333,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="boxautoupdatestatus">
<object class="GtkBox" id="boxAutoUpdateStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">3</property>
......@@ -345,7 +351,7 @@
</packing>
</child>
<child>
<object class="GtkImage" id="autoupdatestatusicon">
<object class="GtkImage" id="iconAutoUpdateStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-no</property>
......@@ -358,7 +364,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="labelautoupdatestatus">
<object class="GtkLabel" id="labelAutoUpdateStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
......@@ -394,14 +400,14 @@
</packing>
</child>
<child>
<object class="GtkSpinButton" id="incrementa_hora">
<object class="GtkSpinButton" id="spinHour">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_width_chars">2</property>
<property name="text" translatable="yes">0</property>
<property name="input_purpose">number</property>
<property name="orientation">vertical</property>
<property name="adjustment">Hour_adjustment</property>
<property name="adjustment">hourAdjustment</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
<property name="wrap">True</property>
......@@ -430,14 +436,14 @@
</packing>
</child>
<child>
<object class="GtkSpinButton" id="incrementa_minuto">
<object class="GtkSpinButton" id="spinMinute">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_width_chars">2</property>
<property name="text" translatable="yes">43</property>
<property name="input_purpose">number</property>
<property name="orientation">vertical</property>
<property name="adjustment">minute_adjustment</property>
<property name="adjustment">minuteAdjustment</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
<property name="wrap">True</property>
......@@ -464,7 +470,7 @@
</packing>
</child>
<child>
<object class="GtkButton">
<object class="GtkButton" id="applyUpdateButton">
<property name="label" translatable="yes">Aplicar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -520,7 +526,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="epoptes_frame">
<object class="GtkFrame" id="frameEpoptes">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -551,7 +557,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="boxepoptesstatus">
<object class="GtkBox" id="boxEpoptesStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">3</property>
......@@ -569,7 +575,7 @@
</packing>
</child>
<child>
<object class="GtkImage" id="epoptesstatusicon">
<object class="GtkImage" id="iconEpoptesStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-no</property>
......@@ -582,7 +588,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="labelepoptesstatus">
<object class="GtkLabel" id="labelEpoptesStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
......@@ -704,7 +710,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="le-edubar_frame">
<object class="GtkFrame" id="frameEdubar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -845,7 +851,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="new_user_frame">
<object class="GtkFrame" id="frameNewUser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -876,7 +882,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="newUserButton">
<object class="GtkButton" id="buttonNewUser">
<property name="label" translatable="yes">Criar novo usuário de Professor</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -926,7 +932,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="multiterminal_frame">
<object class="GtkFrame" id="frameMultiterminal">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -942,7 +948,7 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="multiterminal_reboot_label">
<object class="GtkLabel" id="labelMultiterminalReboot">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Reinicie o computador para configurar o multiterminal.</property>
......@@ -954,7 +960,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="multiterminalButton">
<object class="GtkButton" id="buttonMultiterminal">
<property name="label" translatable="yes">Reconfigurar Multiterminal</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -990,7 +996,7 @@
</packing>
</child>
<child>
<object class="GtkSeparator" id="multiterminal_separator">
<object class="GtkSeparator" id="separatorMultiterminal">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
......@@ -1001,7 +1007,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="help_frame">
<object class="GtkFrame" id="frameHelp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -1058,6 +1064,9 @@
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="newUserBox">
<property name="can_focus">False</property>
......@@ -1068,11 +1077,11 @@
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<object class="GtkButtonBox" id="buttonsNewUser">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="createUserButton">
<object class="GtkButton" id="buttonCreateUser">
<property name="label" translatable="yes">Criar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -1085,7 +1094,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="cancelCreateUserButton">
<object class="GtkButton" id="buttonCancelCreateUser">
<property name="label" translatable="yes">Cancelar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -1105,7 +1114,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -1119,7 +1128,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="userEntry">
<object class="GtkEntry" id="entryUser">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_length">32</property>
......@@ -1132,7 +1141,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="userErrorLabel">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -1144,7 +1153,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -1158,7 +1167,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="nameEntry">
<object class="GtkEntry" id="entryName">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="caps_lock_warning">False</property>
......@@ -1171,7 +1180,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="nameErrorLabel">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -1183,7 +1192,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label12">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -1197,7 +1206,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="passEntry">
<object class="GtkEntry" id="entryPass">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
......@@ -1210,7 +1219,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="cPassEntry">
<object class="GtkEntry" id="entryConfirmPass">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
......@@ -1223,7 +1232,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="passErrorLabel">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -1237,8 +1246,8 @@
</object>
</child>
<action-widgets>
<action-widget response="1">createUserButton</action-widget>
<action-widget response="0">cancelCreateUserButton</action-widget>
<action-widget response="1">buttonCreateUser</action-widget>
<action-widget response="0">buttonCancelCreateUser</action-widget>
</action-widgets>
</object>
</interface>
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