本文整理汇总了Python中Tc2Config类的典型用法代码示例。如果您正苦于以下问题:Python Tc2Config类的具体用法?Python Tc2Config怎么用?Python Tc2Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tc2Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onInitSettings
def onInitSettings(self):
self.layout()
value = Tc2Config.settingsValue(self.SettingsKeyProxyHostName, '').toString()
self.editProxyHostName.setText(value)
self.editProxyHostName.textChanged.connect(self.setProxyHostName)
value, ok = Tc2Config.settingsValue(self.SettingsKeyProxyPort, '').toInt()
if not ok or value > Tc2Config.MaxProxyPort or value < Tc2Config.MinProxyPort:
value = Tc2Config.DefaultProxyPort
self.spinProxyPort.setValue(value)
self.spinProxyPort.valueChanged.connect(self.setProxyPort)
value = Tc2Config.settingsValue(self.SettingsKeyProxyUserName, '').toString()
self.editProxyUserName.setText(value)
self.editProxyUserName.textChanged.connect(self.setProxyUserName)
self.editProxyPassword.textChanged.connect(self.setProxyPassword)
value, ok = Tc2Config.settingsValue(self.SettingsKeyFetchTimeout, '').toDouble()
if not ok or value > Tc2Config.MaxFetchTimeout or value < Tc2Config.MinFetchTimeout:
value = Tc2Config.DefaultFetchTimeout
self.spinFetchTimeout.setValue(value)
self.spinFetchTimeout.valueChanged.connect(self.setFetchTimeout)
Tc2Config.globalObject.objectCreatedSettingsNetwork.emit(self)
示例2: onButtonBackupClicked
def onButtonBackupClicked(self, checked):
dlg = QtGui.QFileDialog(self)
dlg.setWindowTitle('Backup tableCrab To Config File..')
dlg.setFileMode(dlg.AnyFile)
dlg.setAcceptMode(dlg.AcceptSave)
dlg.setConfirmOverwrite(True)
filters = QtCore.QStringList()
filters << 'Config Files (*.ini *.cfg)'
filters << 'All Files (*)'
dlg.setNameFilters(filters)
dlg.restoreState( Tc2Config.settingsValue(self.SettingsKeyDialogBackupState, QtCore.QByteArray()).toByteArray() )
result = dlg.exec_()
Tc2Config.settingsSetValue(self.SettingsKeyDialogBackupState, dlg.saveState() )
if result != dlg.Accepted:
return
fileName = dlg.selectedFiles()[0]
fileInfo = QtCore.QFileInfo(fileName)
format = fileInfo.suffix().toLower()
# default save format to to ".ini"
if not format:
fileName = fileName + '.ini'
#NOTE: looks like Qt is only checking for write protect anything else may or may not pass ..and we don't get any IO errors
# so we try in advance. obv there are still loopholes
fp = None
try: fp = open(fileName, 'w').close()
except Exception, d:
Tc2Config.msgWarning(self, 'Could Not Open Config File\n\n%s' % d)
return
示例3: onGlobalObjectInitSettingsFinished
def onGlobalObjectInitSettingsFinished(self, globalObject):
self.layout()
vipStatus = Tc2Config.settingsValue(self.SettingsKeyVIPStatus, '').toString()
index = self.comboVIPStatus.findText(vipStatus, QtCore.Qt.MatchExactly)
if index >= 0:
self.comboVIPStatus.setCurrentIndex(index)
self.comboVIPStatus.currentIndexChanged.connect(self.onComboVIPStatusCurrentIndexChanged)
gameType = Tc2Config.settingsValue(self.SettingsKeyGameType, '').toString()
index = self.comboGameType.findText(gameType, QtCore.Qt.MatchExactly)
if index >= 0:
self.comboGameType.setCurrentIndex(index)
self.comboGameType.currentIndexChanged.connect(self.onComboGameTypeCurrentIndexChanged)
currency = Tc2Config.settingsValue(self.SettingsKeyCurrency, '').toString()
index = self.comboCurrency.findText(currency, QtCore.Qt.MatchExactly)
if index >= 0:
self.comboCurrency.setCurrentIndex(index)
self.comboCurrency.currentIndexChanged.connect(self.onComboCurrencyCurrentIndexChanged)
conversion = Tc2Config.settingsValue(self.SettingsKeyConversion, '').toString()
if conversion == 'FPPs':
self.radioFPPs.setChecked(True)
else:
self.radioCash.setChecked(True)
示例4: fromConfig
def fromConfig(klass, settingsKey):
id = None
key = ''
hotkeyName = ''
baseValue = None
multiplier = None
id = Tc2Config.settingsValue( (settingsKey, 'ID'), '').toString()
if id != klass.id():
return None
#TODO: rename to "Key"
key = Tc2Config.settingsValue( (settingsKey, 'Hotkey'), Tc2Config.KeyNone).toString()
if key == Tc2Config.KeyNone:
return None
hotkeyName = Tc2Config.settingsValue( (settingsKey, 'HotkeyName'), '').toString()
if klass.HasMultiplier:
multiplier, ok = Tc2Config.settingsValue( (settingsKey, 'Multiplier'), -1.0).toDouble()
if not ok:
return None
if multiplier > klass.MultiplierMax or multiplier < klass.MultiplierMin:
return None
if klass.HasBaseValue:
baseValue = Tc2Config.settingsValue( (settingsKey, 'BaseValue'), '').toString()
if baseValue not in klass.BaseValues:
return None
return klass(key=key, hotkeyName=hotkeyName, baseValue=baseValue, multiplier=multiplier)
示例5: onGlobalObjectInitSettingsFinished
def onGlobalObjectInitSettingsFinished(self, globalObject):
self.layout()
self._splitter.restoreState( Tc2Config.settingsValue(self.SettingsKeySplitterState, QtCore.QByteArray()).toByteArray() )
self._listWidget.setCurrentRow( Tc2Config.settingsValue(self.SettingsKeyCurrentSettingIndex, 0).toInt()[0] )
self._listWidget.setAlternatingRowColors(globalObject.settingsGlobal.alternatingRowColors())
globalObject.settingsGlobal.alternatingRowColorsChanged.connect(self._listWidget.setAlternatingRowColors)
示例6: layout
def layout(self):
grid = Tc2Config.GridBox(self)
grid.col(self.labelAction).col(self.editAction)
grid.row()
grid.col(self.labelHotkey).col(self.hotkeyBox)
grid.row()
grid.col(self.labelHotkeyName).col(self.editHotkeyName)
grid.row()
grid.col(self.labelBaseValue).col(self.comboBaseValue)
grid.row()
grid.col(self.labelMultiplier).col(self.spinMultiplier)
grid.row()
grid.col(Tc2Config.VStretch())
grid.row()
grid.col(Tc2Config.HLine(self), colspan=2)
grid.row()
grid.col(self.buttonBox, colspan=2)
# adjust tab order
Tc2Config.setTabOrder(
self,
self.buttonBox,
self.hotkeyBox,
self.editHotkeyName,
self.comboBaseValue,
self.spinMultiplier,
)
示例7: setFixedFont
def setFixedFont(self, value):
Tc2Config.settingsSetValue(self.SettingsKeyFontFixed, value.toString())
# adjust WeKit fixed font
settings = QtWebKit.QWebSettings.globalSettings()
settings.setFontFamily(settings.FixedFont, value.family() )
settings.setFontSize(settings.DefaultFixedFontSize, value.pointSize() )
self.fixedFontChanged.emit(value)
示例8: onLabelFeedbackDoubleClicked
def onLabelFeedbackDoubleClicked(self):
lastError = self._feedbackMessages[None]
if lastError:
dlg = Tc2DialogException.DialogException(lastError, parent=self)
dlg.restoreGeometry( Tc2Config.settingsValue(self.SettingsKeyDialogExceptionGeometry, QtCore.QByteArray()).toByteArray())
dlg.exec_()
Tc2Config.settingsSetValue(self.SettingsKeyDialogExceptionGeometry, dlg.saveGeometry() )
示例9: onInitSettings
def onInitSettings(self):
self.layout()
value = QtCore.Qt.Checked if Tc2Config.settingsValue(self.SettingsKeyAutoClosePopupNews, False).toBool() else QtCore.Qt.Unchecked
self.checkAutoClosePopupNews.setCheckState(value)
self.checkAutoClosePopupNews.stateChanged.connect(
lambda value, self=self: self.setAutoClosePopupNews(self.checkAutoClosePopupNews.checkState() == QtCore.Qt.Checked)
)
value = QtCore.Qt.Checked if Tc2Config.settingsValue(self.SettingsKeyAutoCloseTourneyRegistrationBoxes, False).toBool() else QtCore.Qt.Unchecked
self.checkAutoCloseTourneyRegistrationBoxes.setCheckState(value)
self.checkAutoCloseTourneyRegistrationBoxes.stateChanged.connect(
lambda value, self=self: self.setAutoCloseTourneyRegistrationBoxes(self.checkAutoCloseTourneyRegistrationBoxes.checkState() == QtCore.Qt.Checked)
)
value = QtCore.Qt.Checked if Tc2Config.settingsValue(self.SettingsKeyAutoCloseTableMessageBoxes, False).toBool() else QtCore.Qt.Unchecked
self.checkAutoCloseTableMessageBoxes.setCheckState(value)
self.checkAutoCloseTableMessageBoxes.stateChanged.connect(
lambda value, self=self: self.setAutoCloseTableMessageBoxes(self.checkAutoCloseTableMessageBoxes.checkState() == QtCore.Qt.Checked)
)
value = QtCore.Qt.Checked if Tc2Config.settingsValue(self.SettingsKeyAutoCloseLogin, False).toBool() else QtCore.Qt.Unchecked
self.checkAutoCloselogin.setCheckState(value)
self.checkAutoCloselogin.stateChanged.connect(
lambda value, self=self: self.setAutoCloseLogin(self.checkAutoCloselogin.checkState() == QtCore.Qt.Checked)
)
value = QtCore.Qt.Checked if Tc2Config.settingsValue(self.SettingsKeyMoveMouseToActiveTable, False).toBool() else QtCore.Qt.Unchecked
self.checkMoveMouseToActiveTable.setCheckState(value)
self.checkMoveMouseToActiveTable.stateChanged.connect(
lambda value, self=self: self.setMoveMouseToActiveTable(self.checkMoveMouseToActiveTable.checkState() == QtCore.Qt.Checked)
)
Tc2Config.globalObject.objectCreatedSettingsPokerStars.emit(self)
示例10: setStyleSheet
def setStyleSheet(self, value):
if Tc2Config.MaxHandStyleSheet >= 0:
if value.length() > Tc2Config.MaxHandStyleSheet:
Tc2Config.globalObject.feedback.emit(self, 'Style sheet too big -- maximum Is %s chars' % Tc2Config.MaxHandStyleSheet)
return
Tc2Config.globalObject.feedback.emit(self, '')
Tc2Config.settingsSetValue(self.SettingsKeyStyleSheet, value)
self.styleSheetChanged.emit(value)
示例11: onEditTextChanged
def onEditTextChanged(self):
text = self.edit.toPlainText()
if Tc2Config.MaxHandStyleSheet >= 0:
if text.length() > Tc2Config.MaxHandStyleSheet:
Tc2Config.globalObject.feedback.emit(self, 'Style sheet too big -- maximum Is %s chars' % Tc2Config.MaxHandStyleSheet)
return
Tc2Config.globalObject.feedback.emit(self, '')
Tc2Config.settingsSetValue(self.SettingsKeyStyleSheet, text)
示例12: toConfig
def toConfig(self, key):
Tc2Config.settingsSetValue( (key, 'ID'), self.id() )
Tc2Config.settingsSetValue( (key, 'Name'), self.name() )
Tc2Config.settingsSetValue( (key, 'Size'), self.size)
Tc2Config.settingsSetValue( (key, 'ItemIsExpanded'), self.itemIsExpanded)
for pointName, point in self.points.items():
Tc2Config.settingsSetValue( (key, pointName), point)
return True
示例13: onCloseEvent
def onCloseEvent(self, event):
Tc2Config.settingsSetValue(self.SettingsKeySplitterState, self.splitter.saveState() )
topicsCollapsed = []
for item in Tc2Config.TreeWidgetItemIterator(self.tree):
if not item.isExpanded():
topic = item.data(0, QtCore.Qt.UserRole).toString()
topicsCollapsed.append(topic)
Tc2Config.settingsSetValue(self.SettingsKeyTopicsCollapsed, topicsCollapsed)
示例14: setGuiStyle
def setGuiStyle(self, value):
style = QtGui.QStyleFactory.create(value)
#TODO: we currently set no palette. QStyle docs say palette should not be set
# for styles that use system defaults, but there seems to be no way to find out
# so ..and where to find some kind of default palette.
##QtGui.qApp.setPalette(style.standardPalette())
QtGui.qApp.setStyle(style)
Tc2Config.settingsSetValue(self.SettingsKeyGuiStyle, value)
self.guiStyleChanged.emit(value)
示例15: onItemSelectionChanged
def onItemSelectionChanged(self):
items = self.tree.selectedItems()
if not items: return
item = items[0]
topic = item.data(0, QtCore.Qt.UserRole).toString()
url = QtCore.QUrl('%s.html' % topic)
self.browser.setUrl(url)
if self._settingsPersistent:
Tc2Config.settingsSetValue(self.SettingsKeyHelpTopic, topic)