def _Add( self ): with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit ' + self._key_name ) as dlg: string_match = ClientParsing.StringMatch() panel = ClientGUIStringPanels.EditStringMatchPanel( dlg, string_match ) dlg.SetPanel( panel ) if dlg.exec() == QW.QDialog.Accepted: key_string_match = panel.GetValue() else: return with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit match' ) as dlg: string_match = ClientParsing.StringMatch() panel = ClientGUIStringPanels.EditStringMatchPanel( dlg, string_match ) dlg.SetPanel( panel ) if dlg.exec() == QW.QDialog.Accepted: value_string_match = panel.GetValue() data = ( key_string_match, value_string_match ) self._listctrl.AddDatas( ( data, ) )
def _Edit(self): edited_datas = [] for data in self._listctrl.GetData(only_selected=True): (key_string_match, value_string_match) = data with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit ' + self._key_name) as dlg: panel = ClientGUIStringPanels.EditStringMatchPanel( dlg, key_string_match) dlg.SetPanel(panel) if dlg.exec() == QW.QDialog.Accepted: key_string_match = panel.GetValue() else: break with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit match') as dlg: panel = ClientGUIStringPanels.EditStringMatchPanel( dlg, value_string_match) dlg.SetPanel(panel) if dlg.exec() == QW.QDialog.Accepted: value_string_match = panel.GetValue() else: break self._listctrl.DeleteDatas((data, )) edited_data = (key_string_match, value_string_match) self._listctrl.AddDatas((edited_data, )) edited_datas.append(edited_data) self._listctrl.SelectDatas(edited_datas) self._listctrl.Sort()
def _Add( self ): with ClientGUIDialogs.DialogTextEntry( self, 'enter the ' + self._key_name, allow_blank = False ) as dlg: if dlg.exec() == QW.QDialog.Accepted: key = dlg.GetValue() if key in self._GetExistingKeys(): QW.QMessageBox.warning( self, 'Warning', 'That {} already exists!'.format( self._key_name ) ) return with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit match' ) as dlg: string_match = ClientParsing.StringMatch() panel = ClientGUIStringPanels.EditStringMatchPanel( dlg, string_match ) dlg.SetPanel( panel ) if dlg.exec() == QW.QDialog.Accepted: string_match = panel.GetValue() data = ( key, string_match ) self._listctrl.AddDatas( ( data, ) )
def _Edit(self): edited_datas = [] for data in self._listctrl.GetData(only_selected=True): (key, string_match) = data with ClientGUIDialogs.DialogTextEntry(self, 'edit the ' + self._key_name, default=key, allow_blank=False) as dlg: if dlg.exec() == QW.QDialog.Accepted: edited_key = dlg.GetValue() if edited_key != key and edited_key in self._GetExistingKeys( ): QW.QMessageBox.warning( self, 'Warning', 'That {} already exists!'.format(self._key_name)) break else: break with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit match') as dlg: string_match = ClientStrings.StringMatch() panel = ClientGUIStringPanels.EditStringMatchPanel( dlg, string_match) dlg.SetPanel(panel) if dlg.exec() == QW.QDialog.Accepted: edited_string_match = panel.GetValue() else: break self._listctrl.DeleteDatas((data, )) edited_data = (edited_key, edited_string_match) self._listctrl.AddDatas((edited_data, )) edited_datas.append(edited_data) self._listctrl.SelectDatas(edited_datas) self._listctrl.Sort()
def _Edit( self ): with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit string converter', frame_key = 'deeply_nested_dialog' ) as dlg: panel = ClientGUIStringPanels.EditStringConverterPanel( dlg, self._string_converter, example_string_override = self._example_string_override ) dlg.SetPanel( panel ) if dlg.exec() == QW.QDialog.Accepted: self._string_converter = panel.GetValue() self._UpdateLabel() self.valueChanged.emit()
def _Edit( self ): test_data = self._test_data_callable() with ClientGUITopLevelWindowsPanels.DialogEdit( self, 'edit string processor', frame_key = 'deeply_nested_dialog' ) as dlg: panel = ClientGUIStringPanels.EditStringProcessorPanel( dlg, self._string_processor, test_data ) dlg.SetPanel( panel ) if dlg.exec() == QW.QDialog.Accepted: self._string_processor = panel.GetValue() self._UpdateLabel()