def __init__(self, topic, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(Tc2Config.dialogTitle('Help') ) self.setWindowIcon( QtGui.QIcon(Tc2Config.Pixmaps.tableCrab()) ) self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok, QtCore.Qt.Horizontal, self) self.buttonBox.accepted.connect(self.accept) self.frameHelp = FrameHelp(parent=self) self.layout() self.frameHelp.onGlobalObjectInitSettingsFinished(Tc2Config.globalObject) #NOTE: we do not save zoom factor on instant help. instant help settings are temporary self.frameHelp.setSettingsPersistent(False) self.restoreGeometry( Tc2Config.settingsValue(self.SettingsKeyGeometry, QtCore.QByteArray()).toByteArray() ) self.frameHelp.splitter.restoreState( Tc2Config.settingsValue(self.SettingsKeySplitterState, QtCore.QByteArray()).toByteArray() ) self.frameHelp.setTopic(topic)
def __init__(self, info, parent=None): QtGui.QDialog. __init__(self, parent) self.setWindowTitle(Tc2Config.dialogTitle('Screenshot Info') ) self._lastScreenshotInfo = info self.edit = QtGui.QPlainTextEdit(self) self.edit.setPlainText(info) self.edit.setReadOnly(True) self.buttonRefresh = QtGui.QPushButton('Refresh', self) self.buttonRefresh.clicked.connect(self.onRefresh) self.buttonRefresh.setToolTip('Save info (Ctrl+R)') action = QtGui.QAction(self) action.setShortcut(QtGui.QKeySequence('Ctrl+R') ) action.triggered.connect(self.onRefresh) self.addAction(action) self.buttonSave = QtGui.QPushButton('Save..', self) self.buttonSave.setToolTip('Save info (Ctrl+S)') self.buttonSave.clicked.connect(self.onSave) action = QtGui.QAction(self) action.setShortcut(QtGui.QKeySequence('Ctrl+S') ) action.triggered.connect(self.onSave) self.addAction(action) self.buttonHelp = QtGui.QPushButton('Help', self) self.buttonHelp.setToolTip('Help (F1)') self.buttonHelp.clicked.connect(self.onHelp) action = QtGui.QAction(self) action.setShortcut(QtGui.QKeySequence('F1') ) action.triggered.connect(self.onHelp) self.addAction(action) self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok, QtCore.Qt.Horizontal, self) self.buttonBox.addButton(self.buttonRefresh, self.buttonBox.ActionRole) self.buttonBox.addButton(self.buttonSave, self.buttonBox.ApplyRole ) self.buttonBox.addButton(self.buttonHelp, self.buttonBox.HelpRole) self.buttonBox.accepted.connect(self.accept) parent.widgetScreenshotInfo.connect(self.onWidgetScreenshotInfo) self.layout() self.restoreGeometry( Tc2Config.settingsValue('Gui/Screenshot/DialogScreenshotInfo/Geometry', QtCore.QByteArray()).toByteArray() )
def __init__(self, pixmap=None, gocrParams=None, gocrParamsDefault=None): QtGui.QDialog.__init__(self) self.setWindowTitle(Tc2Config.dialogTitle('Edit char recognition')) self.gocrParamsDefault = gocrParamsDefault self.toolBar = QtGui.QToolBar(self) self.actionScanImage = QtGui.QAction(self) self.actionScanImage.setText('Scan image') self.actionScanImage.setShortcut(QtGui.QKeySequence('Alt-N') ) self.actionScanImage.setToolTip('Scan Image (Alt+N)') self.actionScanImage.triggered.connect(self.onActionScanImageTriggered) self.toolBar.addAction(self.actionScanImage) self.actionOpenImage = QtGui.QAction(self) self.actionOpenImage.setText('Open image..') self.actionOpenImage.setShortcut(QtGui.QKeySequence('Alt+O') ) self.actionOpenImage.setToolTip('Open Image (Alt+O)') self.actionOpenImage.triggered.connect(self.onActionOpenImageTriggered) self.toolBar.addAction(self.actionOpenImage) self.actionSaveImage = QtGui.QAction(self) self.actionSaveImage.setText('Save image..') self.actionSaveImage.setShortcut(QtGui.QKeySequence('Alt+S') ) self.actionSaveImage.setToolTip('Save Image (Alt+S)') self.actionSaveImage.triggered.connect(self.onActionSaveImageTriggered) self.toolBar.addAction(self.actionSaveImage) self.actionOpenSettings = QtGui.QAction(self) self.actionOpenSettings.setText('Open settings..') self.actionOpenSettings.setShortcut(QtGui.QKeySequence('Atlt+P') ) self.actionOpenSettings.setToolTip('Open Settings (Alt+P)') self.actionOpenSettings.triggered.connect(self.onActionOpenSettingsTriggered) self.toolBar.addAction(self.actionOpenSettings) self.actionSaveSettings = QtGui.QAction(self) self.actionSaveSettings.setText('Save settings..') self.actionSaveSettings.setShortcut(QtGui.QKeySequence('Atlt+A') ) self.actionSaveSettings.setToolTip('Open Settings (Alt+A)') self.actionSaveSettings.triggered.connect(self.onActionSaveSettingsTriggered) self.toolBar.addAction(self.actionSaveSettings) self.actionHelp = QtGui.QAction(self) self.actionHelp.setText('Help') self.actionHelp.setShortcut(QtGui.QKeySequence('F1') ) self.actionHelp.setToolTip('Help (F1)') self.actionHelp.triggered.connect(self.onActionHelpTriggered) self.toolBar.addAction(self.actionHelp) self.buttonBox = QtGui.QDialogButtonBox(QtCore.Qt.Horizontal, self) self.buttonBox.addButton(self.buttonBox.Ok).clicked.connect(self.accept) self.buttonBox.addButton(self.buttonBox.Cancel).clicked.connect(self.reject) self.buttonBox.addButton(self.buttonBox.RestoreDefaults).setEnabled(self.gocrParamsDefault is not None) self.splitterSettings = QtGui.QSplitter(QtCore.Qt.Horizontal, self) # setup settings pane self.frameSettings = QtGui.QFrame(self.splitterSettings) self.splitterSettings.addWidget(self.frameSettings) self.checkBoxChars = QtGui.QCheckBox('Chars', self.frameSettings) self.checkBoxChars.stateChanged.connect(self.onCheckBoxCharsStateChanged) self.editChars = QtGui.QLineEdit(self.frameSettings) self.checkBoxGraylevel = QtGui.QCheckBox('Gray level', self.frameSettings) self.checkBoxGraylevel.stateChanged.connect(self.onCheckBoxGraylevelStateChanged) self.spinGrayLevel = QtGui.QSpinBox(self.frameSettings) self.spinGrayLevel.setRange(gocr.GrayLevelMin, gocr.GrayLevelMax) self.checkBoxDustSize = QtGui.QCheckBox('Dust size', self.frameSettings) self.checkBoxDustSize.stateChanged.connect(self.onCheckBoxDustSizeStateChanged) self.spinDustSize = QtGui.QSpinBox(self.frameSettings) self.spinDustSize.setRange(gocr.DustSizeMin, gocr.DustSizeMax) self.checkBoxWordSpacing = QtGui.QCheckBox('Word spacing', self.frameSettings) self.checkBoxWordSpacing.stateChanged.connect(self.onCheckBoxWordSpacingStateChanged) self.spinWordSpacing = QtGui.QSpinBox(self.frameSettings) self.spinWordSpacing.setRange(gocr.WordSpacingMin, gocr.WordSpacingMax) self.checkBoxCertainty = QtGui.QCheckBox('Certainty', self.frameSettings) self.checkBoxCertainty.stateChanged.connect(self.onCheckBoxCertaintyStateChanged) self.spinCertainty = QtGui.QSpinBox(self.frameSettings) self.spinCertainty.setRange(gocr.CertaintyMin, gocr.CertaintyMax) self.checkBoxInvertImage = QtGui.QCheckBox('Invert image', self.frameSettings) self.checkBoxAnalyzeLayout = QtGui.QCheckBox('Analyze layout', self.frameSettings) self.checkBoxContextCorrection = QtGui.QCheckBox('Context correction', self.frameSettings) self.checkBoxCompareUnknownChars = QtGui.QCheckBox('Compare unknown chars', self.frameSettings) self.checkBoxDivideOverlappingChars = QtGui.QCheckBox('Divide overlapping chars', self.frameSettings) self.checkBoxPackChars = QtGui.QCheckBox('Pack chars', self.frameSettings) self.checkBoxOutputType = QtGui.QCheckBox('Output type', self.frameSettings) self.checkBoxOutputType.stateChanged.connect(self.onCheckBoxOutputTypeStateChanged) self.comboOutputType = QtGui.QComboBox(self.frameSettings) self.comboOutputType.addItems(gocr.OutputTypes) self.checkBoxOutputPattern = QtGui.QCheckBox('Output pattern', self.frameSettings) self.checkBoxOutputPattern.stateChanged.connect(self.onCheckBoxOutputPatternStateChanged) self.editOutputPattern = QtGui.QPlainTextEdit(self.frameSettings) # self.splitterImage = QtGui.QSplitter(QtCore.Qt.Vertical, self.splitterSettings) self.splitterSettings.addWidget(self.splitterImage) self.scrollAreaInputImage = QtGui.QScrollArea( self.splitterImage) self.splitterImage.addWidget(self.scrollAreaInputImage) self.scrollAreaInputImage.setBackgroundRole(QtGui.QPalette.Dark) self.scrollAreaInputImage.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.labelInputImage = QtGui.QLabel(self.scrollAreaInputImage) self.scrollAreaInputImage.setWidget(self.labelInputImage) self.splitterOutput = QtGui.QSplitter(QtCore.Qt.Horizontal, self.splitterImage) self.splitterImage.addWidget(self.splitterOutput) self.webViewOutput = QtWebKit.QWebView(self.splitterOutput) self.splitterOutput.addWidget(self.webViewOutput) self.webViewError = QtWebKit.QWebView(self.splitterOutput) self.splitterOutput.addWidget(self.webViewError) self.setPixmap(pixmap=pixmap) self.setGocrParams(params=gocrParams) self.setOutput(string='') self.setError(string='') self.layout()