コード例 #1
0
 def save(self, evt: wx.CommandEvent):
     if evt.GetEventObject().GetName() == 'BUWC':
         config.save(not evt.IsChecked(), 'showUninstallDialog')
     elif evt.GetEventObject().GetName() == 'VGFC':
         config.save(not evt.IsChecked(), 'showVerifyDialog')
     elif evt.GetEventObject().GetName() == 'SUCC':
         config.save(not evt.IsChecked(), 'startupUpdateCheck')
     elif evt.GetEventObject().GetName() == 'SSC':
         config.save(not evt.IsChecked(), 'showSplashScreen')
     elif evt.GetEventObject().GetName() == 'LDDL':
         config.save(self.LDDL.GetString(evt.GetSelection()), 'lang')
コード例 #2
0
    def OnImportChannels(self, event: wx.CommandEvent) -> None:
        """Add all channels in a file."""
        filepath = wx.LoadFileSelector('Select file to import',
                                       '',
                                       parent=self)
        if not filepath:
            return
        try:
            with open(filepath, 'r') as fh:
                new_channels = json.load(fh)
        except:
            cockpit.gui.ExceptionBox('Failed to read to \'%s\'' % filepath,
                                     parent=self)
        duplicated = [n for n in new_channels.keys() if n in self._channels]
        if duplicated:
            answer = wx.MessageBox(
                'The import will overwrite the following'
                ' channels: %s. Do you want to continue?' %
                ', '.join(duplicated),
                caption='Duplicated channels on loaded file',
                parent=self,
                style=wx.YES_NO)
            if answer != wx.YES:
                return

        menu = event.GetEventObject()
        for name, channel in new_channels.items():
            # Duplicated channels only need to update our dict but new
            # channels also need a new menu item.
            if name not in duplicated:
                self.Bind(wx.EVT_MENU, self.OnApplyChannel,
                          menu.Append(wx.ID_ANY, item=name))
            self._channels[name] = channel
コード例 #3
0
 def onClickCodeButton(self, evt: wx.CommandEvent):
     default_bg_color = (236, 236, 236, 255)
     # print(type(evt), evt.GetEventObject())
     btn = evt.GetEventObject()  # type: wx.BitmapButton
     if btn.GetBackgroundColour() != wx.GREEN:
         btn.SetBackgroundColour(wx.GREEN)
     else:
         btn.SetBackgroundColour(default_bg_color)
コード例 #4
0
 def checkbox_event(event: wx.CommandEvent):
     folder = event.GetEventObject().folder
     for node in folder.children:
         if hasattr(node, 'checkbox'):
             if not event.IsChecked():
                 node.checkbox.SetValue(False)
             node.checkbox.Enable(event.IsChecked())
     event.Skip()
コード例 #5
0
    def _onListItemChecked(self, event: CommandEvent):

        itemName: str = event.GetEventObject().Name
        self.logger.info(f'string: {event.GetString()}')

        columnName, row, column = self.__extractInformationFromName(
            theName=itemName)
        clickedLogger: Logger = self._loggers[row]
        cb: CheckBox = event.GetEventObject()
        isChecked: bool = cb.IsChecked()
        self.logger.info(f'isChecked: `{isChecked}`')

        if columnName == DebugListControl.COLUMN_NAME_PROPAGATE:
            clickedLogger.propagate = isChecked
        elif columnName == DebugListControl.COLUMN_NAME_DISABLED:
            clickedLogger.disabled = isChecked
        else:
            assert False, f'I do not handle this column name: {columnName}'
コード例 #6
0
    def _onLevelChoice(self, event: CommandEvent):

        itemName: str = event.GetEventObject().Name

        columnName, row, column = self.__extractInformationFromName(
            theName=itemName)
        selectedLogger: Logger = self._loggers[row]

        ch: Choice = event.GetEventObject()
        selIdx: int = ch.GetSelection()
        selStr: str = ch.GetString(selIdx)

        # This is weird;  This method goes both ways
        logLevel: int = getLevelName(selStr)
        selectedLogger.setLevel(logLevel)

        self.logger.info(
            f'Changed {selectedLogger.name} to {getLevelName(selectedLogger.level)}'
        )
コード例 #7
0
    def onExit(self, event: CommandEvent):
        """
        Exit the program

        Args:
            event:
        """
        closeEvent: CloseEvent = CloseEvent(EVT_CLOSE.typeId)

        parent: Window = event.GetEventObject().GetWindow()
        wxPostEvent(parent, closeEvent)
コード例 #8
0
	def _onCheckEvent(self, evt: wx.CommandEvent):
		settingsStorage = self._getSettingsStorage()
		if evt.GetEventObject() is self._enabledCheckbox:
			isEnableAllChecked = evt.IsChecked()
			settingsStorage.highlightBrowseMode = isEnableAllChecked
			settingsStorage.highlightFocus = isEnableAllChecked
			settingsStorage.highlightNavigator = isEnableAllChecked
			if not self._ensureEnableState(isEnableAllChecked) and isEnableAllChecked:
				self._onEnableFailure()
			self.updateDriverSettings()
		else:
			self._updateEnabledState()

		providerInst: Optional[NVDAHighlighter] = self._providerControl.getProviderInstance()
		if providerInst:
			providerInst.refresh()
コード例 #9
0
    def OnRemoveChannel(self, event: wx.CommandEvent) -> None:
        """Remove one channel."""
        if not self._channels:
            wx.MessageBox('There are no channels to be removed.',
                          caption='Failed to remove channel',
                          parent=self,
                          style=wx.OK)
            return

        name = wx.GetSingleChoice('Choose channel to be removed:',
                                  caption='Remove a channel',
                                  aChoices=list(self._channels.keys()),
                                  parent=self)
        if not name:
            return

        menu = event.GetEventObject()
        menu.DestroyItem(menu.FindItemById(menu.FindItem(name)))
        self._channels.pop(name)
コード例 #10
0
 def _onCheckEvent(self, evt: wx.CommandEvent):
     settingsStorage = self._getSettingsStorage()
     if evt.GetEventObject() is self._enabledCheckbox:
         settingsStorage.highlightBrowseMode = evt.IsChecked()
         settingsStorage.highlightFocus = evt.IsChecked()
         settingsStorage.highlightNavigator = evt.IsChecked()
         self._ensureEnableState(evt.IsChecked())
         self.updateDriverSettings()
     else:
         self._updateEnabledState()
     providerInst: Optional[
         NVDAHighlighter] = self._providerControl.getProviderInstance()
     if providerInst:
         providerInst.refresh()
     elif evt.IsChecked():
         # One or more check boxes are enabled, so the provider instance must be there.
         # Yet, there is no instance. This must be a case where initialization failed.
         settingsStorage.highlightBrowseMode = False
         settingsStorage.highlightFocus = False
         settingsStorage.highlightNavigator = False
         self.updateDriverSettings()
         self._updateEnabledState()
コード例 #11
0
ファイル: viz_dialog.py プロジェクト: kkyong77/pyvistas
    def OnChoice(self, event: wx.CommandEvent):
        data_choice = event.GetEventObject()
        data = data_choice.GetClientData(event.GetSelection())
        role_idx = self.role_indexes[data_choice]
        sub_idx = data_choice.GetId()

        has_multiple_inputs = self.viz.role_supports_multiple_inputs(role_idx)

        if data is not None:
            if has_multiple_inputs and sub_idx < self.viz.role_size(role_idx):
                self.viz.get_multiple_data(role_idx).pop(sub_idx)

            self.viz.set_data(data, role_idx)
        else:
            if has_multiple_inputs:
                if sub_idx < self.viz.role_size(role_idx):
                    self.viz.remove_subdata(role_idx, sub_idx)
            else:
                self.viz.set_data(None, role_idx)

        if isinstance(self.viz, VisualizationPlugin3D):
            bbox = self.viz.scene.bounding_box
            self.viz.refresh()

            if self.viz.scene.bounding_box != bbox:
                wx.PostEvent(
                    self.GetParent(),
                    ProjectChangedEvent(
                        node=self.node,
                        change=ProjectChangedEvent.ADDED_VISUALIZATION))
            else:
                wx.PostEvent(
                    self.GetParent(),
                    ProjectChangedEvent(
                        node=self.node,
                        change=ProjectChangedEvent.VISUALIZATION_SET_DATA))

        self.RefreshDataOptions()
コード例 #12
0
    def OnAddChannel(self, event: wx.CommandEvent) -> None:
        """Add current channel configuration to list."""
        name = wx.GetTextFromUser('Enter name for new channel:',
                                  caption='Add new channel',
                                  parent=self)
        if not name:
            return
        new_channel = {}
        events.publish('save exposure settings', new_channel)

        if name not in self._channels:
            menu = event.GetEventObject()
            self.Bind(wx.EVT_MENU, self.OnApplyChannel,
                      menu.Append(wx.ID_ANY, item=name))
        else:
            answer = wx.MessageBox('There is already a channel named "%s".'
                                   ' Replace it?' % name,
                                   caption='Channel already exists',
                                   parent=self,
                                   style=wx.YES_NO)
            if answer != wx.YES:
                return

        self._channels[name] = new_channel
コード例 #13
0
    def onRadioButton(self, event: wx.CommandEvent) -> None:
        """Handles testing_choose_time and testing_choose_words radio buttons.
		
		Chooses to show or hide the word count and time limit options based on the
		selected radio button. Also stores radio button state to the application
		configuration.
		"""
        obj = event.GetEventObject()
        self._config.WriteBool(obj.GetName(), obj.GetValue())
        if obj.GetName() == "wordsRadioButton" and obj.GetValue():
            self.testing_time_limit_label.Hide()
            self.testing_time_limit.Hide()
            self.testing_word_count_label.Show()
            self.testing_word_count.Show()
            self._config.WriteBool("wordsRadioButton", value=True)
            self._config.WriteBool("timeRadioButton", value=False)
        elif obj.GetName() == "timeRadioButton" and obj.GetValue():
            self.testing_time_limit_label.Show()
            self.testing_time_limit.Show()
            self.testing_word_count_label.Hide()
            self.testing_word_count.Hide()
            self._config.WriteBool("wordsRadioButton", value=False)
            self._config.WriteBool("timeRadioButton", value=True)
        self.Layout()
コード例 #14
0
ファイル: screenCurtain.py プロジェクト: xingkong0113/nvda
 def _onCheckEvent(self, evt: wx.CommandEvent):
     if evt.GetEventObject() is self._enabledCheckbox:
         self._ensureEnableState(evt.IsChecked())
コード例 #15
0
 def OnApplyChannel(self, event: wx.CommandEvent) -> None:
     name = event.GetEventObject().FindItemById(event.GetId()).GetLabel()
     channel = self._channels[name]
     events.publish('load exposure settings', channel)