Esempio n. 1
0
class ShutdownDialog(WidgetDialog):
    def __init__(self):
        self.exit_model = ButtonModel(_('Exit Freevo'))
        self.exit_model.signals['activated'].connect(self.button_activated)
        self.exit_model.signals['pressed'].connect(self.button_pressed)
        self.reboot_model = ButtonModel(_('Restart System'))
        self.reboot_model.signals['activated'].connect(self.button_activated)
        self.reboot_model.signals['pressed'].connect(self.button_pressed)
        self.shutdown_model = ButtonModel(_('Shutdown System'))
        self.shutdown_model.signals['activated'].connect(self.button_activated)
        self.shutdown_model.signals['pressed'].connect(self.button_pressed)
        self.cancel_model = ButtonModel(_('Cancel'))
        self.cancel_model.signals['activated'].connect(self.button_activated)
        self.cancel_model.signals['pressed'].connect(self.button_pressed)
        buttons = { 'exit'    : self.exit_model,
                    'reboot'  : self.reboot_model,
                    'shutdown': self.shutdown_model,
                    'cancel'  : self.cancel_model}
        super(ShutdownDialog, self).__init__('shutdown', buttons, {})
        if config.SYS_SHUTDOWN_ENABLE:
            self.shutdown_model.set_active(True)
        else:
            self.exit_model.set_active(True)

    def button_activated(self, button):
        self.info['message'] = button.text

    def button_pressed(self, button):
        self.hide()
        if self.exit_model == button:
            shutdown(mode=ShutdownModes.FREEVO_SHUTDOWN)
        elif self.reboot_model == button:
            shutdown(mode=ShutdownModes.SYSTEM_RESTART)
        elif self.shutdown_model == button:
            shutdown(mode=ShutdownModes.SYSTEM_SHUTDOWN)
Esempio n. 2
0
 def __init__(self):
     self.exit_model = ButtonModel(_('Exit Freevo'))
     self.exit_model.signals['activated'].connect(self.button_activated)
     self.exit_model.signals['pressed'].connect(self.button_pressed)
     self.reboot_model = ButtonModel(_('Restart System'))
     self.reboot_model.signals['activated'].connect(self.button_activated)
     self.reboot_model.signals['pressed'].connect(self.button_pressed)
     self.shutdown_model = ButtonModel(_('Shutdown System'))
     self.shutdown_model.signals['activated'].connect(self.button_activated)
     self.shutdown_model.signals['pressed'].connect(self.button_pressed)
     self.cancel_model = ButtonModel(_('Cancel'))
     self.cancel_model.signals['activated'].connect(self.button_activated)
     self.cancel_model.signals['pressed'].connect(self.button_pressed)
     buttons = { 'exit'    : self.exit_model,
                 'reboot'  : self.reboot_model,
                 'shutdown': self.shutdown_model,
                 'cancel'  : self.cancel_model}
     super(ShutdownDialog, self).__init__('shutdown', buttons, {})
     if config.SYS_SHUTDOWN_ENABLE:
         self.shutdown_model.set_active(True)
     else:
         self.exit_model.set_active(True)