本文整理汇总了Python中Tc2Config.handFormatter方法的典型用法代码示例。如果您正苦于以下问题:Python Tc2Config.handFormatter方法的具体用法?Python Tc2Config.handFormatter怎么用?Python Tc2Config.handFormatter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tc2Config
的用法示例。
在下文中一共展示了Tc2Config.handFormatter方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def __init__(self, parent=None):
QtGui.QFrame.__init__(self, parent)
self.labelPrefix = QtGui.QLabel('<i>Prefix</i>', self)
self.labelAction = QtGui.QLabel('<i>Action</i>', self)
self.labelPostfix = QtGui.QLabel('<i>Postfix</i>', self)
self.actionWidgets = {}
formatter = Tc2Config.handFormatter('HtmlTabular')
for i, action in enumerate(formatter.listHandActions()):
prefix, postfix = formatter.actionPrefix(action), formatter.actionPostfix(action)
editPrefix = self.ActionLineEdit(self, action, isPrefix=True)
editPrefix.setMaxLength(Tc2Config.MaxHandGrabberPrefix)
labelAction = QtGui.QLabel('<i>%s</i>' % self.HandActionsMapping[action][0], self)
editPostfix = None
if postfix is not None:
editPostfix = self.ActionLineEdit(self, action, isPrefix=False)
editPostfix.setMaxLength(Tc2Config.MaxHandGrabberPrefix)
self.actionWidgets[action] = {'EditPrefix': editPrefix, 'LabelAction': labelAction, 'EditPostfix': editPostfix, 'no': i}
self.comboSideBarPosition = QtGui.QComboBox(self)
self.comboSideBarPosition.addItems(Tc2Config.HandViewerSideBarPositions)
self.labelSideBarPosition = QtGui.QLabel('&Side bar position:', self)
self.labelSideBarPosition.setBuddy(self.comboSideBarPosition)
self.comboDeckStyle = QtGui.QComboBox(self)
self.comboDeckStyle.addItems(formatter.deckStyles())
self.labelDeckStyle = QtGui.QLabel('Deck st&yle:', self)
self.labelDeckStyle.setBuddy(self.comboDeckStyle)
self.spinMaxPlayerName = QtGui.QSpinBox(self)
self.spinMaxPlayerName.setRange(Tc2Config.HandViewerMaxPlayerNameMin, Tc2Config.HandViewerMaxPlayerNameMax)
self.labelMaxPlayerName = QtGui.QLabel('Ma&x Player Name:', self)
self.labelMaxPlayerName.setBuddy(self.spinMaxPlayerName)
self.checkNoFloatingPoint = QtGui.QCheckBox('No floating &Point', self)
self.buttonBox = QtGui.QDialogButtonBox(self)
self.buttonRestoreDefault = QtGui.QPushButton('Restore Default', self)
self.buttonRestoreDefault.setToolTip('Restore Default (Ctrl+R)')
self.buttonRestoreDefault.clicked.connect(self.onRestoreDefault)
self.buttonBox.addButton(self.buttonRestoreDefault, self.buttonBox.ResetRole)
action = QtGui.QAction(self)
action.setShortcut(QtGui.QKeySequence('Ctrl+R') )
action.triggered.connect(self.onRestoreDefault)
self.addAction(action)
self.buttonHelp = QtGui.QPushButton('Help', self)
self.buttonHelp.setToolTip('Help (F1)')
self.buttonHelp.clicked.connect(self.onHelp)
self.buttonBox.addButton(self.buttonHelp, self.buttonBox.HelpRole)
action = QtGui.QAction(self)
action.setShortcut(QtGui.QKeySequence('F1') )
action.triggered.connect(self.onHelp)
self.addAction(action)
Tc2Config.globalObject.initSettings.connect(self.onInitSettings)
示例2: setStyleSheet
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def setStyleSheet(self, value):
if Tc2Config.MaxHandStyleSheet >= 0:
if len(value) > 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)
formatter = Tc2Config.handFormatter('HtmlTabular')
formatter.setStyleSheet(value)
示例3: onActionValueChanged
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onActionValueChanged(self, edit, text):
formatter = Tc2Config.handFormatter('HtmlTabular')
if edit.isPrefix:
formatter.setActionPrefix(edit.action, text)
settingsKey = self.HandActionsMapping[edit.action][1]
else:
formatter.setActionPostfix(edit.action, text)
settingsKey = self.HandActionsMapping[edit.action][2]
Tc2Config.settingsSetValue(settingsKey, text)
示例4: onRestoreDefault
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onRestoreDefault(self, *args):
formatter = Tc2Config.handFormatter('HtmlTabular')
formatter.resetHandActions()
for data in self.actionWidgets.values():
editPrefix = data['EditPrefix']
editPrefix.setText(formatter.actionPrefix(editPrefix.action))
editPrefix.editingFinished.emit()
editPostfix = data['EditPostfix']
if editPostfix is not None:
editPostfix.setText(formatter.actionPostfix(editPostfix.action))
editPostfix.editingFinished.emit()
示例5: onInitSettings
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onInitSettings(self):
self.layout()
formatter = Tc2Config.handFormatter('HtmlTabular')
value = Tc2Config.settingsValue(self.SettingsKeySideBarPosition, '').toString()
if value not in Tc2Config.HandViewerSideBarPositions:
value = Tc2Config.HandViewerSideBarPositionDefault
self.comboSideBarPosition.setCurrentIndex( self.comboSideBarPosition.findText(value, QtCore.Qt.MatchExactly) )
#NOTE: pySlot decorator does not work as expected so we have to connect slot the old fashioned way
self.connect(self.comboSideBarPosition, QtCore.SIGNAL('currentIndexChanged(QString)'), self.setSideBarPosition)
value = Tc2Config.settingsValue(self.SettingsKeyDeckStyle, '').toString()
if value in formatter.deckStyles():
value = unicode(value.toUtf8(), 'utf-8')
else:
value = Tc2Config.HandViewerDeckStyleDefault
formatter.setDeckStyle(value)
self.comboDeckStyle.setCurrentIndex( self.comboDeckStyle.findText(value, QtCore.Qt.MatchExactly) )
#NOTE: pySlot decorator does not work as expected so we have to connect slot the old fashioned way
self.connect(self.comboDeckStyle, QtCore.SIGNAL('currentIndexChanged(QString)'), self.onDeckStyleChanged)
value, ok = Tc2Config.settingsValue(self.SettingsKeyMaxPlayerName, Tc2Config.HandViewerMaxPlayerNameDefault).toInt()
if not ok or value < Tc2Config.HandViewerMaxPlayerNameMin or value > Tc2Config.HandViewerMaxPlayerNameMax:
value = Tc2Config.WebView.HandViewerMaxPlayerNameDefault
formatter.setMaxPlayerName(value)
self.spinMaxPlayerName.setValue(value)
self.spinMaxPlayerName.valueChanged.connect(self.onMaxPlayerNameChanged)
value = Tc2Config.settingsValue(self.SettingsKeyNoFloatingPoint, Tc2Config.HandViewerNoFloatingPointDefault).toBool()
formatter.setNoFloatingPoint(value)
self.checkNoFloatingPoint.setCheckState(value)
self.checkNoFloatingPoint.stateChanged.connect(self.onNoFloatingPointChanged)
for data in self.actionWidgets.values():
editPrefix = data['EditPrefix']
settingsKey = self.HandActionsMapping[editPrefix.action][1]
text = Tc2Config.settingsValue(settingsKey, formatter.actionPrefix(editPrefix.action)).toString()
editPrefix.setText(text)
formatter.setActionPrefix(editPrefix.action, text)
editPrefix.textChanged.connect(
lambda text, edit=editPrefix: self.onActionValueChanged(edit, text)
)
editPostfix = data['EditPostfix']
if editPostfix is not None:
settingsKey = self.HandActionsMapping[editPrefix.action][2]
text = Tc2Config.settingsValue(settingsKey, formatter.actionPostfix(editPostfix.action)).toString()
editPostfix.setText(text)
formatter.setActionPostfix(editPostfix.action, text)
editPostfix.textChanged.connect(
lambda text, edit=editPostfix: self.onActionValueChanged(edit, text)
)
Tc2Config.globalObject.objectCreatedSettingsHandViewer.emit(self)
示例6: onInitSettings
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onInitSettings(self):
self.layout()
formatter = Tc2Config.handFormatter('HtmlTabular')
#NOTE: style sheet can not be ''
#NOTE: have to connect before setText so we can catch MaxCharsExceeded
value = Tc2Config.settingsValue(self.SettingsKeyStyleSheet, '').toString()
if not value:
value = formatter.styleSheet()
self.edit.setPlainText(value)
formatter.setStyleSheet(value)
self.edit.textChanged.connect(
lambda self=self: self.setStyleSheet(self.edit.toPlainText())
)
Tc2Config.globalObject.objectCreatedSettingsHandViewerStyleSheet.emit(self)
示例7: onNetworkGetData
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onNetworkGetData(self, networkReply):
url = networkReply.url()
if url.scheme() == 'hand':
handNo = int(url.path()[1:])
if handNo > 0:
data = self.handHistoryFile[handNo -1]
try:
hand = self.handParser.parse(data)
except:
Tc2Config.handleException('\n' + data)
#TODO: data = ?
else:
formatter = Tc2Config.handFormatter('HtmlTabular')
data = formatter.dump(hand)
self.sideBarContainer.handleHandSet(hand)
networkReply.setData(data, 'text/html; charset=UTF-8')
示例8: __init__
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def __init__(self, *args, **kws):
PokerStarsWindow.__init__(self, *args, **kws)
self._timer = QtCore.QTimer(self.siteHandler)
self._timer.setInterval(Tc2Config.HandGrabberTimeout * 1000)
self._timer.timeout.connect(self.grabHand)
#self._timer.setSingleShot(True)
self._handParser = Tc2SitePokerStarsHandGrabber.HandParser()
self._handFormatter = Tc2Config.handFormatter('HtmlTabular')
self._data = ''
self._hwndEdit = None
for hwnd in Tc2Win32.windowChildren(self.hwnd):
if Tc2Win32.windowGetClassName(hwnd) == self.WidgetClassName:
self._hwndEdit = hwnd
break
if self._hwndEdit is None:
try:
raise ValueError('Instant hand history edit box not found')
except:
Tc2Config.handleException()
else:
self._timer.start()
示例9: onRestoreDefault
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onRestoreDefault(self):
formatter = Tc2Config.handFormatter('HtmlTabular')
formatter.resetStyleSheet()
self.edit.setPlainText(formatter.styleSheet())
示例10: onNoFloatingPointChanged
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onNoFloatingPointChanged(self, state):
flag = state == QtCore.Qt.Checked
Tc2Config.settingsSetValue(self.SettingsKeyNoFloatingPoint, flag)
formatter = Tc2Config.handFormatter('HtmlTabular')
formatter.setNoFloatingPoint(flag)
示例11: onMaxPlayerNameChanged
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onMaxPlayerNameChanged(self, value):
Tc2Config.settingsSetValue(self.SettingsKeyMaxPlayerName, value)
formatter = Tc2Config.handFormatter('HtmlTabular')
formatter.setMaxPlayerName(value)
示例12: onDeckStyleChanged
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def onDeckStyleChanged(self, value):
Tc2Config.settingsSetValue(self.SettingsKeyDeckStyle, value)
formatter = Tc2Config.handFormatter('HtmlTabular')
formatter.setDeckStyle(unicode(value.toUtf8(), 'utf-8'))
示例13: handFromHtml
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import handFormatter [as 别名]
def handFromHtml(self, html):
handFormatter = Tc2Config.handFormatter('HtmlTabular')
hand = handFormatter.handFromHtml(html)
return hand