示例#1
0
 def acceptChanges(self):
     state = self.getCurrentState()
     oldState = self.colorSchemas[self.selectedSchemaIndex][1]
     if state == oldState:
         QDialog.accept(self)
     else:
         # if we change the default schema, we must save it under a new name
         if self.colorSchemas[self.selectedSchemaIndex][0] == "Default":
             if (QMessageBox.information(
                     self,
                     "Question",
                     "The color schema has changed. Save?",
                     QMessageBox.Yes | QMessageBox.Discard,
             ) == QMessageBox.Discard):
                 QDialog.reject(self)
             else:
                 self.selectedSchemaIndex = self.schemaCombo.count() - 1
                 self.schemaCombo.setCurrentIndex(self.selectedSchemaIndex)
                 self.paletteSelected()
                 QDialog.accept(self)
         # simply save the new users schema
         else:
             self.colorSchemas[self.selectedSchemaIndex] = [
                 self.colorSchemas[self.selectedSchemaIndex][0],
                 state,
             ]
             QDialog.accept(self)
示例#2
0
 def acceptChanges(self):
     state = self.getCurrentState()
     oldState = self.colorSchemas[self.selectedSchemaIndex][1]
     if state == oldState:
         QDialog.accept(self)
     else:
         # if we change the default schema, we must save it under a new name
         if self.colorSchemas[self.selectedSchemaIndex][0] == "Default":
             if QMessageBox.information(
                     self, 'Question',
                     'The color schema has changed. Save?',
                     QMessageBox.Yes | QMessageBox.Discard) == QMessageBox.Discard:
                 QDialog.reject(self)
             else:
                 self.selectedSchemaIndex = self.schemaCombo.count() - 1
                 self.schemaCombo.setCurrentIndex(self.selectedSchemaIndex)
                 self.paletteSelected()
                 QDialog.accept(self)
         # simply save the new users schema
         else:
             self.colorSchemas[self.selectedSchemaIndex] = \
                 [self.colorSchemas[self.selectedSchemaIndex][0], state]
             QDialog.accept(self)