本文整理汇总了Python中PyQt4.QtCore.QByteArray.fromHex方法的典型用法代码示例。如果您正苦于以下问题:Python QByteArray.fromHex方法的具体用法?Python QByteArray.fromHex怎么用?Python QByteArray.fromHex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QByteArray
的用法示例。
在下文中一共展示了QByteArray.fromHex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromHex [as 别名]
def __init__(self, files_to_load):
QMainWindow.__init__(self)
self._inited = False
self._currentMatcher = None
self._lastMatch = None
global globalMainWindow
globalMainWindow = self
self.setWindowTitle(QApplication.applicationName())
self.setWindowIcon(QIcon(':/main/images/hex.png'))
self.subWidgets = []
self._activeSubWidget = None
self.tabsWidget = QTabWidget(self)
self.tabsWidget.setDocumentMode(True)
self.tabsWidget.setTabsClosable(True)
self.tabsWidget.setFocusPolicy(Qt.StrongFocus)
self.tabsWidget.currentChanged.connect(self._onTabChanged)
self.tabsWidget.tabCloseRequested.connect(self.closeTab)
self.setCentralWidget(self.tabsWidget)
self.setFocusProxy(self.tabsWidget)
self.setFocus()
QApplication.instance().focusChanged.connect(self._onGlobalFocusChanged)
self.createActions()
self.buildMenus()
self.buildStatusbar()
self.buildToolbar()
self.dockSearch = SearchDockWidget(self)
self.dockSearch.hide()
self.addDockWidget(Qt.BottomDockWidgetArea, self.dockSearch)
geom = globalQuickSettings['mainWindow.geometry']
if geom and isinstance(geom, str):
self.restoreGeometry(QByteArray.fromHex(geom))
else:
self.resize(800, 600)
state = globalQuickSettings['mainWindow.state']
if state and isinstance(state, str):
self.restoreState(QByteArray.fromHex(state))
app = QApplication.instance()
for file_to_load in files_to_load:
load_options = documents.FileLoadOptions()
load_options.readOnly = app.args.readOnly
load_options.freezeSize = app.args.freezeSize
if app.args.noLoadDialog:
self.openFile(file_to_load, load_options)
else:
self.openFileWithOptionsDialog(file_to_load, load_options)
示例2: loadSettings
# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromHex [as 别名]
def loadSettings(self):
'''
If a settings file exists, then the settings are loaded from it. These override the default values.
'''
try:
with open(settingsFileName) as settingsFile:
settings = settingsFile.readlines()
except IOError:
print("Couldn't read last state from file. Ignoring...")
return
for i in range(len(settings)):
try:
line = makeAllWhitespaceSpaces(settings[i]).split(' ')
if line[0] == 'SIZE':
self.lastWindowWidth = int(line[1])
self.lastWindowHeight = int(line[2])
elif line[0] == 'POSITION':
self.lastWindowLeft = int(line[1])
self.lastWindowTop = int(line[2])
elif line[0] == 'TIME_DECMALStretchyCenteredDisplay_PLACES':
self.decimalPlaces = int(line[1])
elif line[0] == 'INPUT_METHOD' and line[1] in acceptedInputMethods:
self.inputMethod = line[1]
elif line[0] == 'INSPECTION_ENABLED' and line[1] in ['0', '1']:
self.inspectionEnabled = int(line[1])
elif line[0] == 'INSPECTION_TIME':
self.inspectionTimeLimit = int(line[1])
elif line[0] == 'SCRAMBLE_FONT':
fontStartPos = settings[i].find(line[1])
self.newScrambleFont = QtGui.QFont()
self.newScrambleFont.fromString(settings[i][fontStartPos:].strip())
elif line[0] == 'TIMER_DISPLAY_SETTINGS':
self.timerDisplaySplitterSizes = QByteArray.fromHex(line[1].split("'")[1])
elif line[0] == 'BOTTOM_PANEL_SETTINGS':
self.bottomPanelSplitterSizes = QByteArray.fromHex(line[1].split("'")[1])
except:
print("Error reading line", i, "in settings file")
print(" " + settings[i].strip())
示例3: loadGeometry
# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromHex [as 别名]
def loadGeometry(self):
import hex.settings as settings
if self.name:
saved_geom = settings.globalQuickSettings()[self.name + '.geometry']
if saved_geom and isinstance(saved_geom, str):
self.restoreGeometry(QByteArray.fromHex(saved_geom))
示例4: __init__
# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromHex [as 别名]
def __init__(self, *what):
QObject.__init__(self)
if what[0] not in StateSaver.savers:
what[0].installEventFilter(self)
StateSaver.savers[what[0]] = self
self.widgets = []
for widget in what:
name = self.__generateName(widget)
self.widgets.append((name, widget))
Preferences.addString('States', name)
for name, widget in self.widgets:
oldState = QByteArray.fromHex(Preferences[name])
if isinstance(widget, (QSplitter, QHeaderView)):
widget.restoreState(oldState)
else:
widget.restoreGeometry(oldState)