def init_close_dialog(self): from qtvcp.widgets.dialog_widget import CloseDialog w = self.QTVCP_INSTANCE_ w.closeDialog_ = CloseDialog(w) w.closeDialog_.setObjectName('closeDialog_') w.closeDialog_.hal_init(HAL_NAME='') w.closeDialog_.overlay_color = self._messageDialogColor
def init_close_dialog(self): from qtvcp.widgets.dialog_widget import CloseDialog w = self.QTVCP_INSTANCE_ w.closeDialog_ = CloseDialog() w.closeDialog_.hal_init(self.HAL_GCOMP_, self.HAL_NAME_, w.closeDialog_, w, w.PATHS, self.PREFS_) w.closeDialog_.overlay_color = self._messageDialogColor
def _hal_init(self): # Read user preferences if self.PREFS_: self.catch_errors = self.PREFS_.getpref('catch_errors', True, bool, 'SCREEN_OPTIONS') self.desktop_notify = self.PREFS_.getpref('desktop_notify', True, bool, 'SCREEN_OPTIONS') self.close_event = self.PREFS_.getpref('shutdown_check', True, bool, 'SCREEN_OPTIONS') self.play_sounds = self.PREFS_.getpref('sound_player_on', True, bool, 'SCREEN_OPTIONS') self.mchnMsg_play_sound = self.PREFS_.getpref( 'mchnMsg_play_sound', True, bool, 'MCH_MSG_OPTIONS') self.mchnMsg_speak_errors = self.PREFS_.getpref( 'mchnMsg_speak_errors', True, bool, 'MCH_MSG_OPTIONS') self.mchnMsg_sound_type = self.PREFS_.getpref( 'mchnMsg_sound_type', 'ERROR', str, 'MCH_MSG_OPTIONS') self.usrMsg_play_sound = self.PREFS_.getpref( 'usermsg_play_sound', True, bool, 'USR_MSG_OPTIONS') self.usrMsg_sound_type = self.PREFS_.getpref( 'userMsg_sound_type', 'RING', str, 'USR_MSG_OPTIONS') self.usrMsg_use_FocusOverlay = self.PREFS_.getpref( 'userMsg_use_focusOverlay', True, bool, 'USR_MSG_OPTIONS') self.shutdown_play_sound = self.PREFS_.getpref( 'shutdown_play_sound', True, bool, 'SHUTDOWN_OPTIONS') self.shutdown_alert_sound_type = self.PREFS_.getpref( 'shutdown_alert_sound_type', 'ATTENTION', str, 'SHUTDOWN_OPTIONS') self.shutdown_exit_sound_type = self.PREFS_.getpref( 'shutdown_exit_sound_type', 'LOGOUT', str, 'SHUTDOWN_OPTIONS') self.shutdown_msg_title = self.PREFS_.getpref( 'shutdown_msg_title', 'Do you want to Shutdown now?', str, 'SHUTDOWN_OPTIONS') self.shutdown_msg_detail = self.PREFS_.getpref( 'shutdown_msg_detail', 'This option can be changed in the preference file', str, 'SHUTDOWN_OPTIONS') self.notify_start_title = self.PREFS_.getpref( 'notify_start_title', 'Welcome', str, 'NOTIFY_OPTIONS') self.notify_start_detail = self.PREFS_.getpref( 'notify_start_detail', 'This is a test screen for QtVCP', str, 'NOTIFY_OPTIONS') self.notify_start_timeout = self.PREFS_.getpref( 'notify_start_timeout', 10, int, 'NOTIFY_OPTIONS') # connect to STATUS to catch linuxcnc events if self.catch_errors: STATUS.connect('periodic', self.on_periodic) if self.close_event: self.QTVCP_INSTANCE_.closeEvent = self.closeEvent if self.play_sounds: try: SOUND._register_messages() except: self.play_sounds = False LOG.warning('Sound Option turned off due to error registering') if self.user_messages: MSG.message_setup(self.HAL_GCOMP_) MSG.message_option('NOTIFY', NOTE) if self.play_sounds: MSG.message_option('play_sounds', self.usrMsg_play_sound) else: MSG.message_option('play_sounds', False) MSG.message_option('alert_sound', self.usrMsg_sound_type) MSG.message_option('use_focus_overlay', self.usrMsg_use_FocusOverlay) # If there is a widget named statusBar give a reference to desktop notify try: NOTE.statusbar = self.QTVCP_INSTANCE_.statusbar except Exception as e: LOG.info('Exception adding status to notify:', exc_info=e) if self.desktop_notify: NOTE.notify(self.notify_start_title, self.notify_start_detail, None, self.notify_start_timeout, self.notify_start_timeout) # clear and add an intial machine log message STATUS.emit('update-machine-log', '', 'DELETE') STATUS.emit('update-machine-log', '', 'INITIAL') STATUS.connect( 'tool-info-changed', lambda w, data: self._tool_file_info(data, TOOL.COMMENTS)) # We supply our own dialog for closing self.CLOSE_DIALOG = CloseDialog()