Пример #1
0
 def setup(self):
     # Set the default font
     font = QFont()
     font.setFamily('Courier')
     font.setFixedPitch(True)
     font.setPointSize(10)
     self.setFont(font)
     self.setMarginsFont(font)
     fontmetrics = QFontMetrics(font)
     self.setMarginsFont(font)
     self.setMarginWidth(0, fontmetrics.width('0000'))
     self.setMarginLineNumbers(0, True)
     self.setMarginsBackgroundColor(QColor('#cccccc'))
     self.setMarginSensitivity(1, True)
     self.marginClicked.connect(self.on_margin_clicked)
     self.markerDefine(QsciScintilla.RightTriangle, self.ARROW_MARKER_NUM)
     self.setMarkerBackgroundColor(QColor('#ee1111'), self.ARROW_MARKER_NUM)
     self.markerDefine(QsciScintilla.Circle, self.REC_MARKER_NUM)
     self.setMarkerBackgroundColor(QColor('#87CEEB'), self.REC_MARKER_NUM)
     self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
     self.setCaretLineVisible(True)
     self.setCaretLineBackgroundColor(QColor('#FFA07A'))
     self.my_lexer = OrLexer(self)
     self.setLexer(self.my_lexer)
     self.setAutoCompletionThreshold(1)
     self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
     self.tracking_marker = None
Пример #2
0
    def __init__(self, get_markdown, save, parent=None):
        super(notetextedit, self).__init__(parent)

        self.save = save

        self.setLineWrapMode(QTextEdit.WidgetWidth)
        self.setTabChangesFocus(True)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setMinimumWidth(300)

        self.setMouseTracking(True)

        font = QFont()
        font.setPointSize(10)
        font.setFamily("helvetica")
        document = self.document()
        document.setDefaultFont(font)

        self.font = font

        document.setDefaultStyleSheet(
            "pre{margin-top:0px; margin-bottom:0px} li{margin-top:0px; margin-bottom:0px}"
        )

        QTimer.singleShot(0, get_markdown)
Пример #3
0
	def __init__(self, parent, node, icon, x=0, y=0):
		'''
		The node is a Node object (from snifferData.nodes),
		icon is a QPixmap object
		'''
		super(NetworkNode, self).__init__(parent)
		
		self.width_ = 130
		self.height_ = 81
		font = QFont()
		font.setFamily("DejaVu Sans Mono")
		font.setPointSize(9)
		
		self.lbl_icon = QLabel(self)
		self.lbl_icon.setGeometry(QtCore.QRect(50, 0, 48, 48))
		self.lbl_icon.setObjectName("lbl_icon")
		self.lbl_icon.setPixmap(icon)
		
		self.lbl_name = QLabel(self)
		self.lbl_name.setGeometry(QtCore.QRect(0, 50, self.width_, 16))
		self.lbl_name.setObjectName("lbl_name")
		self.lbl_name.setAlignment(QtCore.Qt.AlignCenter)
		self.lbl_name.setText(node.name)
		self.lbl_name.setFont(font)
		
		
		self.lbl_addr = QLabel(self)
		self.lbl_addr.setGeometry(QtCore.QRect(0, 65, self.width_, 16))
		self.lbl_addr.setObjectName("lbl_addr")
		self.lbl_addr.setAlignment(QtCore.Qt.AlignCenter)
		self.lbl_addr.setText('<span style="color:#888">%s</span>' % node.address)
		self.lbl_addr.setFont(font)
		
		self.setGeometry(QtCore.QRect(x, y, self.width_, self.height_))
Пример #4
0
    def createAboutWidget(self):
        self.AboutDock = QDockWidget("About", self)
        self.AboutDock.setObjectName("about")
        self.AboutDock.setTitleBarWidget(QWidget())
        self.AboutDock.setContentsMargins(0, 0, 0, 0)
        self.tabifyDockWidget(self.LegendDock, self.AboutDock)
        self.LegendDock.raise_()  # legendDock at the top

        from PyQt4.QtCore import QRect
        from PyQt4.QtGui import QSizePolicy, QGridLayout, QFont
        font = QFont()
        font.setFamily("Sans Serif")
        font.setPointSize(8.7)
        self.AboutWidget = QWidget()
        self.AboutWidget.setFont(font)
        self.AboutWidget.setObjectName("AboutWidget")
        self.AboutDock.setWidget(self.AboutWidget)
        self.labelAbout = QLabel(self.AboutWidget)
        self.labelAbout.setAlignment(Qt.AlignCenter)
        self.labelAbout.setWordWrap(True)
        self.gridLayout = QGridLayout(self.AboutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout.addWidget(self.labelAbout, 0, 1, 1, 1)
        self.labelAbout.setTextInteractionFlags(Qt.LinksAccessibleByMouse
                                                | Qt.LinksAccessibleByKeyboard
                                                | Qt.TextSelectableByKeyboard
                                                | Qt.TextSelectableByMouse)
        self.labelAbout.setOpenExternalLinks(True)
        self.labelAbout.setText("<html><head/><body><a href=\"http://geotux.tuxfamily.org/index.php/en/geo-blogs/item/293-consola-sql-para-plugin-pgadmin-postgis-viewer\">PostGIS Layer Viewer</a> v.1.6.1 (2015.02.24)<br \><br \>" \
            "Copyright (c) 2010 Ivan Mincik,<br \>[email protected]<br \>" \
            u"Copyright (c) 2011-2015 Germán Carrillo,<br \>[email protected]<br \><br \>" \
            "<i>Licensed under the terms of GNU GPL v.2.0</i><br \><br \>" \
            "Based on PyQGIS. Plugin Fast SQL Layer by Pablo T. Carreira.</body></html>" )
Пример #5
0
class Font():
    '''
    @note::
        添加字体类
    '''
    def __init__(self, font_path):
        self.__font = QFont()
        self.font_path = font_path

    def addFont(self):
        '''
        @note::
            成功或者失败
        '''
        font_path = self.font_path
        fontId = QFontDatabase.addApplicationFont(font_path)
        if (fontId != -1):
            fontInfoList = QFontDatabase.applicationFontFamilies(fontId)
            fontFamily = fontInfoList[0]
            self.__font.setFamily(fontFamily)
            log.info("添加字体成功")
            return True
        else:
            log.warning("添加字体失败")
            return False

    def getFont(self):
        self.addFont()
        return self.__font
Пример #6
0
 def setFont(self):
     font = QFont()
     font.setFamily(self.fontName)
     fdialog = QFontDialog(self)
     fdialog.show()
     fdialog.setCurrentFont(font)
     fdialog.accepted.connect(lambda:self.setFontName(fdialog.currentFont()))
Пример #7
0
	def data(self, index, role=Qt.DisplayRole):
		"""
		This function is used by Qt to obtain data needed by the view.
		It is mandatory for the model to work.
		"""
		if not index.isValid() or not (0 <= index.row() < len(self.nodes)):
			return QVariant()
			
		node = self.nodes[index.row()]
		column = index.column()
			
		if role == Qt.DisplayRole:
			if column == PANID:
				return QVariant(node.panId)
				
			elif column == ADDRESS:
				return QVariant(node.address)
				
			elif column == NAME:
				return QVariant(node.name)

		elif role == Qt.FontRole:
			if column in (PANID, ADDRESS):
				font = QFont()
				font.setFamily("DejaVu Sans Mono")
				return font
		return QVariant()
Пример #8
0
    def __init__(self, parent=None, text=None,
                 EditorHighlighterClass=PythonHighlighter,
                 indenter=PythonCodeIndenter):
        QPlainTextEdit.__init__(self, parent)
        self.setFrameStyle(QFrame.NoFrame)
        self.setTabStopWidth(4)
        self.setLineWrapMode(QPlainTextEdit.NoWrap)
        font = QFont()
        font.setFamily("lucidasanstypewriter")
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
        self.highlighter = EditorHighlighterClass(self)
        if text:
            self.setPlainText(text)
        self.frame_style = self.frameStyle()
        self.draw_line = True
        self.print_width = self.fontMetrics().width("x"*78)
        self.line_pen = QPen(QColor("lightgrey"))
        self.last_row = self.last_col = -1
        self.last_block = None
        self.highlight_line = True
        self.highlight_color = self.palette().highlight().color().light(175)
        self.highlight_brush = QBrush(QColor(self.highlight_color))
        self.connect(self, SIGNAL("cursorPositionChanged()"), 
                        self.onCursorPositionChanged)
        self.indenter = indenter(RopeEditorWrapper(self))
        # True if you want to catch Emacs keys in actions
        self.disable_shortcuts = False

        self.prj = get_no_project()
        self.prj.root = None
        self.calltip = CallTip(self)
        self.autocomplete = AutoComplete(self)
    def createAboutWidget( self ):
        self.AboutDock = QDockWidget( "About", self )
        self.AboutDock.setObjectName( "about" )
        self.AboutDock.setTitleBarWidget( QWidget() )
        self.AboutDock.setContentsMargins( 0, 0, 0, 0 )
        self.tabifyDockWidget( self.LegendDock, self.AboutDock )
        self.LegendDock.raise_() # legendDock at the top

        from PyQt4.QtCore import QRect
        from PyQt4.QtGui import QSizePolicy, QGridLayout, QFont
        font = QFont()
        font.setFamily("Sans Serif")
        font.setPointSize(8.7)
        self.AboutWidget = QWidget()
        self.AboutWidget.setFont( font )
        self.AboutWidget.setObjectName("AboutWidget") 
        self.AboutDock.setWidget( self.AboutWidget )
        self.labelAbout = QLabel( self.AboutWidget )
        self.labelAbout.setAlignment(Qt.AlignCenter)
        self.labelAbout.setWordWrap(True)
        self.gridLayout = QGridLayout(self.AboutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout.addWidget(self.labelAbout, 0, 1, 1, 1)
        self.labelAbout.setTextInteractionFlags(Qt.LinksAccessibleByMouse|Qt.LinksAccessibleByKeyboard|Qt.TextSelectableByKeyboard|Qt.TextSelectableByMouse) 
        self.labelAbout.setOpenExternalLinks( True )
        self.labelAbout.setText("<html><head/><body><a href=\"http://geotux.tuxfamily.org/index.php/en/geo-blogs/item/293-consola-sql-para-plugin-pgadmin-postgis-viewer\">PostGIS Layer Viewer</a> v.1.6.1 (2015.02.24)<br \><br \>" \
            "Copyright (c) 2010 Ivan Mincik,<br \>[email protected]<br \>" \
            u"Copyright (c) 2011-2015 Germán Carrillo,<br \>[email protected]<br \><br \>" \
            "<i>Licensed under the terms of GNU GPL v.2.0</i><br \><br \>" \
            "Based on PyQGIS. Plugin Fast SQL Layer by Pablo T. Carreira.</body></html>" )
Пример #10
0
    def __init__(self, parent=None):
        super(MikidownCfgDialog, self).__init__(parent)
        #tab = QWidget()
        #tab2 = QWidget()
        self.setWindowTitle(self.tr("Settings - mikidown"))
        self.recentNotesCount = QSpinBox()
        recent_notes_n = Mikibook.settings.value('recentNotesNumber',type=int, defaultValue=20)
        self.recentNotesCount.setValue(recent_notes_n)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
                                          QDialogButtonBox.Cancel)
        self.hltCfg = MikidownHighlightCfgWidget(parent=self)
        self.tabWidth = QSpinBox(self)
        self.tabWidth.setRange(2, 8)
        self.tabWidth.setSingleStep(2)
        self.iconTheme = QLineEdit(self)
        self.iconTheme.setText(Mikibook.settings.value('iconTheme', QIcon.themeName()))

        self.editorFont = QFontButton(parent=self)
        fontval = QFont()
        fontfam = Mikibook.settings.value('editorFont', defaultValue=None)
        fontsize = Mikibook.settings.value('editorFontSize', type=int, defaultValue=12)
        if fontfam is not None:
            fontval.setFamily(fontfam)
        fontval.setPointSize(fontsize)

        self.headerScalesFont = QCheckBox(self)
        if Mikibook.settings.value('headerScaleFont', type=bool, defaultValue=True):
            self.headerScalesFont.setCheckState(Qt.Checked)
        else:
            self.headerScalesFont.setCheckState(Qt.Unchecked)

        self.editorFont.font = fontval

        self.tabWidth.setValue(Mikibook.settings.value('tabWidth', type=int, defaultValue=4))

        self.tabToSpaces = QCheckBox(self)
        if Mikibook.settings.value('tabInsertsSpaces', type=bool, defaultValue=True):
            self.tabToSpaces.setCheckState(Qt.Checked)
        else:
            self.tabToSpaces.setCheckState(Qt.Unchecked)

        layout = QGridLayout(self)
        layout.addWidget(QLabel(self.tr("# of recently viewed notes to keep")),0,0,1,1)
        layout.addWidget(self.recentNotesCount,0,1,1,1)
        layout.addWidget(QLabel(self.tr("Editor font")), 1, 0, 1, 1)
        layout.addWidget(self.editorFont, 1, 1, 1, 1)
        layout.addWidget(QLabel(self.tr("Header rank scales editor font?")), 2, 0, 1, 1)
        layout.addWidget(self.headerScalesFont, 2, 1, 1, 1)
        qs = QScrollArea(self)
        qs.setWidget(self.hltCfg)
        layout.addWidget(QLabel(self.tr("Tabs expand to spaces?")), 3, 0, 1, 1)
        layout.addWidget(self.tabToSpaces, 3, 1, 1, 1)
        layout.addWidget(QLabel(self.tr("Tab width")), 4, 0, 1, 1)
        layout.addWidget(self.tabWidth, 4, 1, 1, 1)
        layout.addWidget(QLabel(self.tr("Icon Theme")),5,0,1,1)
        layout.addWidget(self.iconTheme,5,1,1,1)
        layout.addWidget(qs,6,0,1,2)
        layout.addWidget(self.buttonBox,7,0,1,2)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Пример #11
0
class Hints(QGraphicsItem):

    def __init__(self, x_offset, y_offset):
        super(Hints, self).__init__()

        self.x_offset = x_offset
        self.y_offset = y_offset

        self.path = None
        self.setup_display()

    def setup_display(self, step=0):
        steps = ["Press Alt: matching commits mode",
                 "Keep pressing Alt and hover over a commit",
                 "That way you can see all the commits that have the same name"]
        self.path = QPainterPath()

        self.font = QFont()
        self.font.setFamily("Helvetica")
        self.font.setPointSize(FONT_SIZE)
        self.path.addText(
            self.x_offset,
            self.y_offset,
            self.font, QString(steps[step]))

    def boundingRect(self):
        return self.path.boundingRect()

    def shape(self):
        return self.path

    def paint(self, painter, option, widget=None):
        painter.setPen(Qt.NoPen)
        painter.setBrush(QBrush(BLACK))
        painter.drawPath(self.path)
Пример #12
0
 def __init__(self, mime, parent=None):
     QTextEdit.__init__(self, parent)
     self.setAcceptRichText(False)
     font = QFont()
     font.setFamily('Terminal [DEC]')
     self.setFont(font)
     ts = QFontMetrics(font).maxWidth()
Пример #13
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator)
        #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
       
        self.vBoxSizer = QVBoxLayout()
        self.hBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.anotherFortuneButton = QPushButton(self.tr("One More!"), self)
        self.anotherFortuneButton.clicked.connect(self.onClickAnotherFortuneButton)
        self.hBoxSizer.addWidget(self.anotherFortuneButton)

        idx = random.choice(range(len(self.prm['appData']['fortunesList'])))

        self.browser.append(self.prm['appData']['fortunesList'][idx]['quote'])
        self.browser.append('\n')
        self.browser.append(self.prm['appData']['fortunesList'][idx]['author'])
        self.browser.append("In:" + self.prm['appData']['fortunesList'][idx]['source'])

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.browser.setFont(font)
        
        self.vBoxSizer.addWidget(self.browser)
        self.vBoxSizer.addLayout(self.hBoxSizer)
        #self.vBoxSizer.setSizeConstraint(QLayout.SetFixedSize)
        
        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("pychoacoustics - fortunes"))
        self.resize(450, 450)
        self.show()
Пример #14
0
    def __init__(self, parent=None, text=None,
                 EditorHighlighterClass=PythonHighlighter,
                 indenter=PythonCodeIndenter):
        QPlainTextEdit.__init__(self, parent)
        self.setFrameStyle(QFrame.NoFrame)
        self.setTabStopWidth(4)
        self.setLineWrapMode(QPlainTextEdit.NoWrap)
        font = QFont()
        font.setFamily("lucidasanstypewriter")
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
        self.highlighter = EditorHighlighterClass(self)
        if text:
            self.setPlainText(text)
        self.frame_style = self.frameStyle()
        self.draw_line = True
        self.print_width = self.fontMetrics().width("x"*78)
        self.line_pen = QPen(QColor("lightgrey"))
        self.last_row = self.last_col = -1
        self.last_block = None
        self.highlight_line = True
        self.highlight_color = self.palette().highlight().color().light(175)
        self.highlight_brush = QBrush(QColor(self.highlight_color))
        self.connect(self, SIGNAL("cursorPositionChanged()"), 
                        self.onCursorPositionChanged)
        self.indenter = indenter(RopeEditorWrapper(self))
        # True if you want to catch Emacs keys in actions
        self.disable_shortcuts = False

        self.prj = get_no_project()
        self.prj.root = None
        self.calltip = CallTip(self)
        self.autocomplete = AutoComplete(self)
Пример #15
0
class Font():
    '''
    @note::
        添加字体类
    '''
    def __init__(self, font_path):
        self.__font = QFont()
        self.font_path = font_path

    def addFont(self):
        '''
        @note::
            成功或者失败
        '''
        font_path = self.font_path
        fontId = QFontDatabase.addApplicationFont(font_path)
        if(fontId != -1):
            fontInfoList = QFontDatabase.applicationFontFamilies(fontId)
            fontFamily = fontInfoList[0]
            self.__font.setFamily(fontFamily)
            log.info("添加字体成功")
            return True
        else:
            log.warning("添加字体失败")
            return False

    def getFont(self):
        self.addFont()
        return self.__font
Пример #16
0
    def __init__(self, view: Amendment('view/', lambda v: hasattr(v, 'mode') and (v.mode.name == 'ipython') and (v.widget is None))): #, orig_editor=None):
        if view.widget is None:
            self.globals = {}
            self.globals['ddic'] = ddic
            for a in ddic['actions']:
                self.globals[a] = ddic['actions'][a]
                
            self.locals = {}
#             ddic.provide('interactive', -1)
        else:
            self.globals = view.widget.globals
            self.locals = view.widget.locals
        
        super().__init__(view)

        # Set the default font
        font = QFont()
        font.setFamily('DejaVu Sans Mono')
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
#        self.parser = Parser(self, 'python3')
#         self.ca = PyInterpretContentAssist()
        fontmetrics = QFontMetrics(font)

        # Brace matching: enable for a brace immediately before or after
        # the current position
        #
        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        # Set Python lexer
        # Set style for Python comments (style number 1) to a fixed-width
        # courier.
        #
#         self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'DejaVu Sans Mono'.encode())
        

        # Don't want to see the horizontal scrollbar at all
        # Use raw message to Scintilla here (all messages are documented
        # here: http://www.scintilla.org/ScintillaDoc.html)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
        
        self.setMinimumSize(fontmetrics.width("00000"), fontmetrics.height()+4)
        
        self.markerDefine(QsciScintilla.RightArrow,
            self.ARROW_MARKER_NUM)
#         self.setMarkerBackgroundColor(QColor("#ee1111"),
#             self.ARROW_MARKER_NUM)

        self.prompt_begin = 0
        self.focus_view = None
        self.interactive = False
Пример #17
0
 def __init__(self, view: Amendment('view/', lambda v: hasattr(v, 'mode') and (v.mode.name == '__statusbar__') and (v.widget is None))):
     super().__init__()
     self.view = view
     self.view.widget = self
     font = QFont()
     font.setFamily('DejaVu Sans Mono')
     font.setFixedPitch(True)
     font.setPointSize(10)    
     self.setFont(font);
Пример #18
0
    def __init__(self, parent=None):
        super(MyQTextBrowser, self).__init__(parent)
        # Set the default font
        font = QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
        self.setMarginsFont(font)
        self.setUtf8(True)

        # Margin 0 is used for line numbers
        font_metrics = QFontMetrics(font)
        self.setMarginsFont(font)
        self.setMarginWidth(0, font_metrics.width("000") + 4)
        self.setMarginLineNumbers(0, True)
        self.setMarginsBackgroundColor(QColor("#cccccc"))

        # Clickable margin 1 for showing markers
        self.setMarginSensitivity(1, True)
        self.connect(self,
                     SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),
                     self.on_margin_clicked)
        self.markerDefine(QsciScintilla.RightArrow,
                          self.ARROW_MARKER_NUM)
        self.setMarkerBackgroundColor(QColor("#ee1111"),
                                      self.ARROW_MARKER_NUM)

        # Brace matching: enable for a brace immediately before or after
        # the current position
        #
        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        # Set Python lexer
        # Set style for Python comments (style number 1) to a fixed-width
        # courier.
        #
        lexer = QsciLexerXML()
        lexer.setDefaultFont(font)
        self.setLexer(lexer)
        self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')

        # Don't want to see the horizontal scrollbar at all
        # Use raw message to Scintilla here (all messages are documented
        # here: http://www.scintilla.org/ScintillaDoc.html)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.setHorizontalScrollBar(QScrollBar(self))

        self.fp = None
        self.item = None
        self.html_mapper = dict()
        self.setReadOnly(True)
Пример #19
0
    def __init__(self, *args):
        QPlainTextEdit.__init__(self, *args)

        self.setMaximumWidth(655)

        font = QFont('')
        font.setFamily('Courier')
        font.setStyleHint(QFont.Monospace)
        font.setPointSize(10)
        self.setFont(font)
Пример #20
0
    def _load_code_editor_settings(self):
        """
        Load settings on the code editor like, font style, margins, scroll, etc.
        Based on the example from http://eli.thegreenplace.net/2011/04/01/sample-using-qscintilla-with-pyqt/
        """

        item = self.form.font_size.currentText()
        size = int(item)

        # Set the default font
        font = QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(size)
        self._code_editor.setFont(font)
        self._code_editor.setMarginsFont(font)

        # Margin 0 is used for line numbers
        fontmetrics = QFontMetrics(font)
        self._code_editor.setMarginsFont(font)
        self._code_editor.setMarginWidth(0, fontmetrics.width("00000") + 6)
        self._code_editor.setMarginLineNumbers(0, True)
        self._code_editor.setMarginsBackgroundColor(QColor("#cccccc"))

        # Clickable margin 1 for showing markers
        self._code_editor.setMarginSensitivity(1, True)
        self._code_editor.marginClicked.connect(self.on_margin_clicked)
        self._code_editor.markerDefine(QsciScintilla.RightArrow,
                                       self.ARROW_MARKER_NUM)
        self._code_editor.setMarkerBackgroundColor(QColor("#ee1111"),
                                                   self.ARROW_MARKER_NUM)

        # Detect changes to text
        self._code_editor.modificationChanged.connect(
            self.on_modification_changed)

        # Brace matching: enable for a brace immediately before or after the current position
        self._code_editor.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self._code_editor.setCaretLineVisible(True)
        self._code_editor.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        # Set Python lexer
        # Set style for Python comments (style number 1) to a fixed-width Courier.
        lexer = self.lexer()
        lexer.setDefaultFont(font)
        self._code_editor.setLexer(lexer)
        self._code_editor.setIndentationWidth(4)
        # self._code_editor.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
        self._code_editor.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1)

        # Don't want to see the horizontal scrollbar at all
        # Use raw message to Scintilla here (all messages are documented here: http://www.scintilla.org/ScintillaDoc.html)
        self._code_editor.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
Пример #21
0
    def setCommonOptions(self):
        # Enable non-ASCII characters
        self.setUtf8(True)

        # Default font
        font = QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(20)
        self.setFont(font)
        self.setMarginsFont(font)

        self.initLexer()

        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        self.setWrapMode(QsciScintilla.WrapWord)
        self.setWrapVisualFlags(QsciScintilla.WrapFlagByText,
                                QsciScintilla.WrapFlagNone, 4)

        self.setSelectionForegroundColor(QColor('#2e3436'))
        self.setSelectionBackgroundColor(QColor('#babdb6'))

        # Show line numbers
        self.setMarginWidth(1, '000')
        self.setMarginLineNumbers(1, True)
        self.setMarginsForegroundColor(QColor('#2e3436'))
        self.setMarginsBackgroundColor(QColor('#babdb6'))

        # Highlight current line
        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QColor('#d3d7cf'))

        # Folding
        self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
        self.setFoldMarginColors(QColor('#d3d7cf'), QColor('#d3d7cf'))

        # Mark column 80 with vertical line
        self.setEdgeMode(QsciScintilla.EdgeLine)
        self.setEdgeColumn(80)
        self.setEdgeColor(QColor('#eeeeec'))

        # Indentation
        self.setAutoIndent(True)
        self.setIndentationsUseTabs(False)
        self.setIndentationWidth(4)
        self.setTabIndents(True)
        self.setBackspaceUnindents(True)
        self.setTabWidth(4)

        # Autocomletion
        self.setAutoCompletionThreshold(2)
        self.setAutoCompletionSource(QsciScintilla.AcsAPIs)

        self.setFonts(10)
Пример #22
0
    def setCommonOptions(self):
        # Enable non-ASCII characters
        self.setUtf8(True)

        # Default font
        font = QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(20)
        self.setFont(font)
        self.setMarginsFont(font)

        self.initLexer()

        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        self.setWrapMode(QsciScintilla.WrapWord)
        self.setWrapVisualFlags(QsciScintilla.WrapFlagByText,
                                QsciScintilla.WrapFlagNone, 4)

        self.setSelectionForegroundColor(QColor('#2e3436'))
        self.setSelectionBackgroundColor(QColor('#babdb6'))

        # Show line numbers
        self.setMarginWidth(1, '000')
        self.setMarginLineNumbers(1, True)
        self.setMarginsForegroundColor(QColor('#2e3436'))
        self.setMarginsBackgroundColor(QColor('#babdb6'))

        # Highlight current line
        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QColor('#d3d7cf'))

        # Folding
        self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
        self.setFoldMarginColors(QColor('#d3d7cf'), QColor('#d3d7cf'))

        # Mark column 80 with vertical line
        self.setEdgeMode(QsciScintilla.EdgeLine)
        self.setEdgeColumn(80)
        self.setEdgeColor(QColor('#eeeeec'))

        # Indentation
        self.setAutoIndent(True)
        self.setIndentationsUseTabs(False)
        self.setIndentationWidth(4)
        self.setTabIndents(True)
        self.setBackspaceUnindents(True)
        self.setTabWidth(4)

        # Autocomletion
        self.setAutoCompletionThreshold(2)
        self.setAutoCompletionSource(QsciScintilla.AcsAPIs)

        self.setFonts(10)
Пример #23
0
 def __init__(self, parent=None):
     super(htmlPreview, self).__init__(parent)
     hbox = QHBoxLayout()
     self.refreshButton = QPushButton(u"Refresh")
     hbox.addWidget(self.refreshButton, 0)
     hbox.addStretch(1)
     self.refreshAndClearButton = QPushButton(u"Refresh + Clear")
     hbox.addWidget(self.refreshAndClearButton)
     vbox = QVBoxLayout()
     vbox.addLayout(hbox, 0)
     self.preview = QWebView(self)
     # save a shortcut reference to web page and its history
     self.webPage = self.preview.page()
     self.history = self.preview.page().history()
     vbox.addWidget(self.preview, 1)
     self.setLayout(vbox)
     # make the web preview uneditable
     self.webPage.setContentEditable(False)
     self.settings = self.preview.settings()
     # Find out the nearest font to Palatino
     qf = QFont()
     qf.setStyleStrategy(QFont.PreferAntialias + QFont.PreferMatch)
     qf.setStyleHint(QFont.Serif)
     qf.setFamily(QString(u'Palatino'))
     qfi = QFontInfo(qf)
     # set the default font to that serif font
     self.settings.setFontFamily(QWebSettings.StandardFont, qfi.family())
     self.settings.setFontSize(QWebSettings.DefaultFontSize, 16)
     self.settings.setFontSize(QWebSettings.MinimumFontSize, 6)
     self.settings.setFontSize(QWebSettings.MinimumLogicalFontSize, 6)
     self.zoomFactor = 1.0
     # Disable everything but bog-standard html, appropriate for PP
     self.settings.setAttribute(QWebSettings.JavascriptEnabled, False)
     self.settings.setAttribute(QWebSettings.JavaEnabled, False)
     self.settings.setAttribute(QWebSettings.PluginsEnabled, False)
     self.settings.setAttribute(QWebSettings.ZoomTextOnly, False)
     # the following causes a hard error in linux
     #self.settings.setAttribute(QWebSettings.SiteSpecificQuirksEnabled, False)
     # hook up the refresh buttons
     self.connect(self.refreshButton, SIGNAL("clicked()"),
                  self.refresh1Click)
     self.connect(self.refreshAndClearButton, SIGNAL("clicked()"),
                  self.refresh2Click)
     # hook up the load status signals
     self.connect(self.preview, SIGNAL("loadStarted()"), self.loadStarts)
     self.connect(self.preview, SIGNAL("loadProgress(int)"),
                  self.loadProgresses)
     self.connect(self.preview, SIGNAL("loadFinished(bool)"), self.loadEnds)
     # here we store the scroll position to return to after reloading
     self.scrollPosition = QPoint(0, 0)
     # here save the user's find text for ctl-g use
     self.findText = QString()
     # here store the base URL for the current book.
     self.baseURL = QUrl()
Пример #24
0
def getMonoFont(fontsize=12, msg=False):
    monofont = QFont()
    monofont.setStyleStrategy(QFont.PreferAntialias+QFont.PreferMatch)
    monofont.setStyleHint(QFont.Courier)
    monofont.setFamily(IMC.fontFamily)
    monofont.setFixedPitch(True) # probably unnecessary
    monofont.setPointSize(fontsize)
    if msg and (monofont.family() != IMC.fontFamily):
        infoMsg("Font {0} not available, using {1}".format(
            IMC.fontFamily, monoinf.family()) )
    return monofont
Пример #25
0
 def __init__(self):
     """Configures all the properties.
     """
     super().__init__()
     font = QFont()
     font.setFamily('Courier')
     font.setFixedPitch(True)
     font.setPointSize(10)
     metrics = QFontMetrics(font)
     self.setFont(font)
     self.setTabStopWidth(2 * metrics.width(' '))       
     self.highlighter = XmlHighlighter(self.document())
Пример #26
0
    def __init__(self, settings, name, filename, plain_text=False, parent=None):
        super().__init__(parent=parent)
        splitty = QSplitter(self)
        self.setWidget(splitty)
        self.setWindowTitle(os.path.basename(name))
        self.setFloating(True)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.plain_text = plain_text
        self.notePath = settings.notePath

        fh = QFile(filename)
        try:
            if not fh.open(QIODevice.ReadOnly):
                raise IOError(fh.errorString())
        except IOError as e:
            QMessageBox.warning(self, self.tr("Read Error"),
                                self.tr("Failed to open %s: %s") % (filename, e))
        finally:
            if fh is not None:
                noteBody = QTextStream(fh).readAll()
                fh.close()
                self.tocw = TocTree(self)
                splitty.addWidget(self.tocw)

                strip_math_for_header_parsing = False
                strip_fence_for_header_parsing = False

                self.tocw.itemClicked.connect(self.tocNavigate)
                if 'asciimathml' in settings.extensions:
                    stuff=JSCRIPT_TPL.format(settings.mathjax)
                    strip_math_for_header_parsing = True
                else:
                    stuff=''
                if 'fenced_code' in settings.extensions or 'extra' in settings.extensions:
                    strip_fence_for_header_parsing = True
                if plain_text:
                    note_view = QPlainTextEdit(self)
                    qfnt = QFont()
                    qfnt.setFamily('monospace')
                    note_view.setFont(qfnt)
                    note_view.setPlainText(noteBody)
                else:
                    note_view = QWebView(self)
                    note_view.setHtml(settings.md.reset().convert(noteBody)+stuff)
                    note_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
                    note_view.linkClicked.connect(self.linkClicked)
                    note_view.settings().setUserStyleSheetUrl( 
                     QUrl('file://'+self.parent().settings.cssfile))
                self.note_view = note_view
                splitty.addWidget(note_view)
                self.tocw.updateToc(os.path.basename(name), 
                    parseHeaders(noteBody, strip_fenced_block=strip_fence_for_header_parsing,
                        strip_ascii_math=strip_math_for_header_parsing))
Пример #27
0
    def _load_code_editor_settings(self):
        """
        Load settings on the code editor like, font style, margins, scroll, etc.
        Based on the example from http://eli.thegreenplace.net/2011/04/01/sample-using-qscintilla-with-pyqt/
        """

        item = self.form.font_size.currentText()
        size = int(item)

        # Set the default font
        font = QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(size)
        self._code_editor.setFont(font)
        self._code_editor.setMarginsFont(font)

        # Margin 0 is used for line numbers
        fontmetrics = QFontMetrics(font)
        self._code_editor.setMarginsFont(font)
        self._code_editor.setMarginWidth(0, fontmetrics.width("00000") + 6)
        self._code_editor.setMarginLineNumbers(0, True)
        self._code_editor.setMarginsBackgroundColor(QColor("#cccccc"))

        # Clickable margin 1 for showing markers
        self._code_editor.setMarginSensitivity(1, True)
        self._code_editor.marginClicked.connect(self.on_margin_clicked)
        self._code_editor.markerDefine(QsciScintilla.RightArrow, self.ARROW_MARKER_NUM)
        self._code_editor.setMarkerBackgroundColor(QColor("#ee1111"), self.ARROW_MARKER_NUM)

        # Detect changes to text
        self._code_editor.modificationChanged.connect(self.on_modification_changed)

        # Brace matching: enable for a brace immediately before or after the current position
        self._code_editor.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self._code_editor.setCaretLineVisible(True)
        self._code_editor.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        # Set Python lexer
        # Set style for Python comments (style number 1) to a fixed-width Courier.
        lexer = self.lexer()
        lexer.setDefaultFont(font)
        self._code_editor.setLexer(lexer)
        self._code_editor.setIndentationWidth(4)
        # self._code_editor.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
        self._code_editor.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1)

        # Don't want to see the horizontal scrollbar at all
        # Use raw message to Scintilla here (all messages are documented here: http://www.scintilla.org/ScintillaDoc.html)
        self._code_editor.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
Пример #28
0
    def __init__(self, parent = None):
        QDialog.__init__(self)

        self.parentDlg = parent
        self.setObjectName(("ui_ProjectMngForm"))
        self.resize(100, 100)
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.setFont(font)
        self.setWindowTitle("User Login")

        self.vlForm = QVBoxLayout(self)
        self.vlForm.setObjectName(("vl_ProjectMngForm"))
        self.vlForm.setSpacing(9)
        self.vlForm.setMargin(9)

        self.basicFrame = Frame(self)
        self.vlForm.addWidget(self.basicFrame)

        self.textNameLogin = TextBoxPanel(self.basicFrame)
        self.textNameLogin.LabelWidth = 70
        self.textNameLogin.Width = 120
        self.textNameLogin.Caption = "User Name"
        self.basicFrame.Add = self.textNameLogin

        self.textPasswordLogin = TextBoxPanel(self.basicFrame)
        self.textPasswordLogin.LabelWidth = 70
        self.textPasswordLogin.Width = 120
        self.textPasswordLogin.Caption = "Password"
        self.textPasswordLogin.EchoMode = "Password"
        self.basicFrame.Add = self.textPasswordLogin

        self.btnFrame = Frame(self.basicFrame, "HL")
        self.basicFrame.Add = self.btnFrame

        horizontalSpacer = QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.btnFrame.layoutBoxPanel.addItem(horizontalSpacer)

        self.buttonLogin = QPushButton(self.btnFrame)
        self.buttonLogin.setObjectName("buttonLogin")
        self.buttonLogin.setText("Login")
        self.btnFrame.Add = self.buttonLogin

        horizontalSpacer1 = QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.btnFrame.layoutBoxPanel.addItem(horizontalSpacer1)

        # self.connect(self.listBoxProject, SIGNAL("Event_0"), self.listBoxProject_SelectedIndexChanged)
        # self.connect(self.textPathProject, SIGNAL("Event_1"), self.buttonBrowseProject_Click)

        self.buttonLogin.clicked.connect(self.buttonLogin_Click)
Пример #29
0
def font_from_dict(font_dict, font=None):
    if font is None:
        font = QFont()
    else:
        font = QFont(font)

    if "family" in font_dict:
        font.setFamily(font_dict["family"])

    if "size" in font_dict:
        font.setPixelSize(font_dict["size"])

    return font
Пример #30
0
        def __init__(self, parent=None):
            super(SimplePythonEditorWidget, self).__init__(parent)

            # Set the default font
            font = QFont()
            font.setFamily('Courier')
            font.setFixedPitch(True)
            font.setPointSize(10)
            self.setFont(font)
            self.setMarginsFont(font)

            # Margin 0 is used for line numbers
            fontmetrics = QFontMetrics(font)
            self.setMarginsFont(font)
            self.setMarginWidth(0, fontmetrics.width("00000") + 6)
            self.setMarginLineNumbers(0, True)
            self.setMarginsBackgroundColor(QColor("#cccccc"))

            # Clickable margin 1 for showing markers
            self.setMarginSensitivity(1, True)
            self.connect(
                self,
                QtCore.SIGNAL(
                    'marginClicked(int, int, Qt::KeyboardModifiers)'),
                self.on_margin_clicked)
            self.markerDefine(Qsci.QsciScintilla.RightArrow,
                              self.ARROW_MARKER_NUM)
            self.setMarkerBackgroundColor(QColor("#ee1111"),
                                          self.ARROW_MARKER_NUM)

            # Brace matching: enable for a brace immediately before or after
            # the current position
            self.setBraceMatching(Qsci.QsciScintilla.SloppyBraceMatch)

            # Current line visible with special background color
            self.setCaretLineVisible(True)
            self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

            # Set Python lexer
            # Set style for Python comments (style number 1) to a fixed-width
            # courier.
            lexer = Qsci.QsciLexerPython()
            lexer.setDefaultFont(font)
            self.setLexer(lexer)
            self.SendScintilla(Qsci.QsciScintilla.SCI_STYLESETFONT, 1,
                               'Courier')

            # Don't want to see the horizontal scrollbar at all
            # Use raw message to Scintilla here (all messages are documented
            # here: http://www.scintilla.org/ScintillaDoc.html)
            self.SendScintilla(Qsci.QsciScintilla.SCI_SETHSCROLLBAR, 0)
Пример #31
0
 def __init__(self, parent=None ):
     super(htmlPreview, self).__init__(parent)
     hbox = QHBoxLayout()
     self.refreshButton = QPushButton(u"Refresh")
     hbox.addWidget(self.refreshButton,0)
     hbox.addStretch(1)
     self.refreshAndClearButton = QPushButton(u"Refresh + Clear")
     hbox.addWidget(self.refreshAndClearButton)
     vbox = QVBoxLayout()
     vbox.addLayout(hbox,0)
     self.preview = QWebView(self)
     # save a shortcut reference to web page and its history
     self.webPage = self.preview.page()
     self.history = self.preview.page().history()
     vbox.addWidget(self.preview,1)
     self.setLayout(vbox)
     # make the web preview uneditable
     self.webPage.setContentEditable(False)
     self.settings = self.preview.settings()
     # Find out the nearest font to Palatino
     qf = QFont()
     qf.setStyleStrategy(QFont.PreferAntialias+QFont.PreferMatch)
     qf.setStyleHint(QFont.Serif)
     qf.setFamily(QString(u'Palatino'))
     qfi = QFontInfo(qf)
     # set the default font to that serif font
     self.settings.setFontFamily(QWebSettings.StandardFont, qfi.family())
     self.settings.setFontSize(QWebSettings.DefaultFontSize, 16)
     self.settings.setFontSize(QWebSettings.MinimumFontSize, 6)
     self.settings.setFontSize(QWebSettings.MinimumLogicalFontSize, 6)
     self.zoomFactor = 1.0
     # Disable everything but bog-standard html, appropriate for PP
     self.settings.setAttribute(QWebSettings.JavascriptEnabled, False)
     self.settings.setAttribute(QWebSettings.JavaEnabled, False)
     self.settings.setAttribute(QWebSettings.PluginsEnabled, False)
     self.settings.setAttribute(QWebSettings.ZoomTextOnly, False)
     # the following causes a hard error in linux
     #self.settings.setAttribute(QWebSettings.SiteSpecificQuirksEnabled, False)
     # hook up the refresh buttons
     self.connect(self.refreshButton, SIGNAL("clicked()"),self.refresh1Click)
     self.connect(self.refreshAndClearButton, SIGNAL("clicked()"),self.refresh2Click)
     # hook up the load status signals
     self.connect(self.preview,SIGNAL("loadStarted()"),self.loadStarts )
     self.connect(self.preview,SIGNAL("loadProgress(int)"),self.loadProgresses )
     self.connect(self.preview,SIGNAL("loadFinished(bool)"),self.loadEnds )
     # here we store the scroll position to return to after reloading
     self.scrollPosition = QPoint(0,0)
     # here save the user's find text for ctl-g use
     self.findText = QString()
     # here store the base URL for the current book.
     self.baseURL = QUrl()
Пример #32
0
    def make_heading(self, heading):
        # not finished
        cursor = self.textCursor()
        cursor.select(QTextCursor.BlockUnderCursor) #QTextCursor.LineUnderCursor

        char_format = QTextCharFormat()
        #font = self.font this is a problem  because it changes self.font gets changed below
        font = QFont()
        font.setFamily("helvetica")
        font.setPointSize({1:20, 2:15, 3:12}[heading])
        font.setBold(True)
        char_format.setFont(font)

        cursor.setCharFormat(char_format)
Пример #33
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)
        #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.vBoxSizer = QVBoxLayout()
        self.hBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.setMinimumHeight(80)
        self.buttonBox.buttons()[0].setMinimumHeight(80)
        self.hBoxSizer.addWidget(self.buttonBox)
        cw = self.parent().parent()
        if cw.prm["storedBlocks"] > 0:
            storedInstr = cw.prm['b' +
                                 str(cw.prm['currentBlock'])]['instructions']
            if len(storedInstr) > 0:
                self.browser.append(storedInstr)
            else:
                self.browser.append(
                    self.tr("Sorry, there are no instructions for this task."))
        else:
            storedInstr = self.parent().parent().instructionsTF.toPlainText()
            if len(storedInstr) > 0:
                self.browser.append(storedInstr)
            else:
                self.browser.append(
                    self.tr("Sorry, there are no instructions for this task."))
        self.browser.append("\n\nPress the ESC key to exit this screen.")

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(22)
        self.browser.setFont(font)

        self.vBoxSizer.addWidget(self.browser)
        self.vBoxSizer.addLayout(self.hBoxSizer)
        #self.vBoxSizer.setSizeConstraint(QLayout.SetFixedSize)

        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Task Instructions"))
        #self.resize(900, 600)
        self.showFullScreen()
Пример #34
0
    def make_heading(self, heading):
        # not finished
        cursor = self.textCursor()
        cursor.select(QTextCursor.BlockUnderCursor) #QTextCursor.LineUnderCursor

        char_format = QTextCharFormat()
        #font = self.font this is a problem  because it changes self.font gets changed below
        font = QFont()
        font.setFamily("helvetica")
        font.setPointSize({1:20, 2:15, 3:12}[heading])
        font.setBold(True)
        char_format.setFont(font)

        cursor.setCharFormat(char_format)
Пример #35
0
def tuple_to_qfont(tup):
    """
    Create a QFont from tuple:
        (family [string], size [int], italic [bool], bold [bool])
    """
    if not isinstance(tup, tuple) or len(tup) != 2 \
       or not font_is_installed(tup[0]) \
       or not isinstance(tup[1], int):
        return None
    font = QFont()
    family, size = tup
    font.setFamily(family)
    font.setPointSize(size)
    return font
Пример #36
0
 def _customize_field(self, option, field, label):
     #set style-sheets and fonts
     if option.name == 'sequence':
         font = QFont()
         font.setFamily('Monospace')
         field.setFont(font)
     #connect signals to slots
     elif option.name == 'config':
         field.textChanged.connect(self._load_config)
     elif option.name == 'working_directory':
         field.setText(QString.fromUtf8(os.path.abspath(self._cwdir)))
         field.editingFinished.connect(self._check_cwdir_field)
     elif option.name == 'template_files':
         field.textChanged.connect(self._del_seq_db_if_changed)
Пример #37
0
    def __init__(self, mainwindow):
        QsciScintilla.__init__(self, mainwindow)
        self.mainwindow = mainwindow
        ## define the font to use
        font = QFont()
        font.setFamily("Consolas")
        font.setFixedPitch(True)
        font.setPointSize(10)
        # the font metrics here will help
        # building the margin width later
        fm = QFontMetrics(font)

        ## set the default font of the editor
        ## and take the same font for line numbers
        self.setFont(font)
        self.setMarginsFont(font)

        ## Line numbers
        # conventionnaly, margin 0 is for line numbers
        self.setMarginWidth(0, fm.width( "00000" ) + 5)
        self.setMarginLineNumbers(0, True)

        ## Edge Mode shows a red vetical bar at 80 chars
        self.setEdgeMode(QsciScintilla.EdgeLine)
        self.setEdgeColumn(80)
        self.setEdgeColor(QColor("#CCCCCC"))

        ## Folding visual : we will use boxes
        self.setFolding(QsciScintilla.BoxedTreeFoldStyle)

        ## Braces matching
        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        ## Editing line color
        #self.setCaretLineVisible(True)
        #self.setCaretLineBackgroundColor(QColor("#CDA869"))

        ## Margins colors
        # line numbers margin
        self.setMarginsBackgroundColor(QColor("#333333"))
        self.setMarginsForegroundColor(QColor("#CCCCCC"))

        # folding margin colors (foreground,background)
        #self.setFoldMarginColors(QColor("#99CC66"),QColor("#333300"))
        self.setFoldMarginColors(QColor("#CCCCCC"),QColor("#CCCCCC"))

        ## Choose a lexer
        lexer = QsciLexerPython()
        lexer.setDefaultFont(font)
        self.setLexer(lexer)
Пример #38
0
 def getFont(self,
             font_family,
             font_size=10,
             bold=False,
             italic=False,
             Underline=False):
     font = QFont()
     font.setFamily(_fromUtf8(font_family))
     font.setPixelSize(font_size)
     font.setFixedPitch(True)
     font.setBold(bold)
     font.setItalic(italic)
     font.setUnderline(Underline)
     return font
Пример #39
0
 def _customize_field(self, option, field, label):
     #set style-sheets and fonts
     if option.name == 'sequence':
         font = QFont()
         font.setFamily('Monospace')
         field.setFont(font)
     #connect signals to slots
     elif option.name == 'config':
         field.textChanged.connect(self._load_config)
     elif option.name == 'working_directory':
         field.setText(QString.fromUtf8(os.path.abspath(self._cwdir)))
         field.editingFinished.connect(self._check_cwdir_field)
     elif option.name == 'template_files':
         field.textChanged.connect(self._del_seq_db_if_changed)
Пример #40
0
class quitW(QWidget):
    """Define the quit button widget"""
    def __init__(self, parent=None):
        QPushButton.__init__(self)
        vlayout = QVBoxLayout()
        self.button = QPushButton('Quit?')
        self.font = QFont()
        self.font.setFamily("Times")
        self.font.setPointSize(40)
        self.font.setBold(False)
        self.button.setFont(self.font)
        vlayout.addWidget(self.button)
        mainLayout = QGridLayout()
        mainLayout.addLayout(vlayout, 0, 1)
        self.setLayout(mainLayout)
 def uiStateInit(self):
     self.ui.grbMostCritical.setVisible(False)
     self.ui.grbResult_2.setVisible(False)
     self.ui.btnPDTCheck.setVisible(False)   
     self.ui.btnUpdateQA.setVisible(False)
     self.ui.btnUpdateQA_2.setVisible(False)
     self.ui.frm_cmbObstSurface.setVisible(False)
     self.ui.tabCtrlGeneral.removeTab(2)
     self.ui.chbHideDisregardableObst = QCheckBox(self.ui.grbObstacles)
     self.ui.chbHideDisregardableObst.setText("Hide disregardable obstacles")
     font = QFont()
     font.setFamily("Arial")
     font.setBold(False)
     self.ui.chbHideDisregardableObst.setFont(font)
     self.ui.vlObstacles.addWidget(self.ui.chbHideDisregardableObst)
     return FlightPlanBaseDlg.uiStateInit(self)        
 def setSampleFont(font, familyOnly, sizeOnly):
     """
     Local function to set the font of the sample text.
     
     @param font font to be set (QFont)
     @param familyOnly flag indicating to set the font family only (boolean)
     @param sizeOnly flag indicating to set the font size only (boolean
     """
     if familyOnly or sizeOnly:
         newFont = QFont(self.lexer.font(self.style))
         if familyOnly:
             newFont.setFamily(font.family())
         if sizeOnly:
             newFont.setPointSize(font.pointSize())
         self.sampleText.setFont(newFont)
     else:
         self.sampleText.setFont(font)
 def changeCurrentFormat(self):
     newFont = QFont()
     newFont.setFamily( self.mFontComboBox.currentFont().family() )
     #bold
     if ( self.mBoldPushButton.isChecked() ):
         newFont.setBold( True )
     else:
         newFont.setBold( False )
     #italic
     if ( self.mItalicsPushButton.isChecked() ):
         newFont.setItalic( True )
     else:
         newFont.setItalic( False )
     #size
     newFont.setPointSize( self.mFontSizeSpinBox.value() )
     self.mTextEdit.setCurrentFont( newFont )
     #color
     self.mTextEdit.setTextColor( self.mFontColorButton.color() )
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator)
        #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
       
        self.vBoxSizer = QVBoxLayout()
        self.hBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.setMinimumHeight(80)
        self.buttonBox.buttons()[0].setMinimumHeight(80)
        self.hBoxSizer.addWidget(self.buttonBox)
        cw = self.parent().parent()
        if cw.prm["storedBlocks"] > 0:
            storedInstr = cw.prm['b'+ str(cw.prm['currentBlock'])]['instructions']
            if len(storedInstr) > 0:
                self.browser.append(storedInstr)
            else:
                self.browser.append(self.tr("Sorry, there are no instructions for this task."))
        else:
            storedInstr = self.parent().parent().instructionsTF.toPlainText()
            if len(storedInstr) > 0:
                self.browser.append(storedInstr)
            else:
                self.browser.append(self.tr("Sorry, there are no instructions for this task."))
        self.browser.append("\n\nPress the ESC key to exit this screen.")

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(22)
        self.browser.setFont(font)
        
        self.vBoxSizer.addWidget(self.browser)
        self.vBoxSizer.addLayout(self.hBoxSizer)
        #self.vBoxSizer.setSizeConstraint(QLayout.SetFixedSize)
        
        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Task Instructions"))
        #self.resize(900, 600)
        self.showFullScreen()
Пример #45
0
    def __init__(self, parent):
        self.parent = parent
        super(PythonConsoleWidget, self).__init__('Python Console', parent=parent)
        #super(QDockWidget, self).__init__('Python Console', parent=parent) # I think this works by accident in qt4/5

        self.listMenu = QMenu()
        self.execute_python_button = QPushButton('Execute')
        self.execute_and_clear_python_button = QPushButton('Execute and Clear')

        if is_pygments and is_scintilla:
            #self.enter_data = QSyntaxHighlighting()
            self.enter_data = SimplePythonEditorWidget()
        else:
            self.enter_data = QTextEdit()
            font = QFont()
            font.setFamily('Courier')
            self.enter_data.setFont(font)
        self.setup_connections()
        self.layout()
Пример #46
0
    def __init__(self, parent=None ):
        super(helpDisplay, self).__init__(parent)
        # make page unmodifiable
        self.page().setContentEditable(False)
        # initialize settings
        # Find out the nearest font to Palatino
        qf = QFont()
        qf.setStyleStrategy(QFont.PreferAntialias+QFont.PreferMatch)
        qf.setStyleHint(QFont.Serif)
        qf.setFamily(QString(u'Palatino'))
        qfi = QFontInfo(qf)
        # set the default font to that serif font
        self.settings().setFontFamily(QWebSettings.StandardFont, qfi.family())
        self.settings().setFontSize(QWebSettings.DefaultFontSize, 16)
        self.settings().setFontSize(QWebSettings.MinimumFontSize, 6)
        self.settings().setFontSize(QWebSettings.MinimumLogicalFontSize, 6)
        self.textZoomFactor = 1.0
        self.setTextSizeMultiplier(self.textZoomFactor)
        self.settings().setAttribute(QWebSettings.JavascriptEnabled, False)
        self.settings().setAttribute(QWebSettings.JavaEnabled, False)
        self.settings().setAttribute(QWebSettings.PluginsEnabled, False)
        self.settings().setAttribute(QWebSettings.ZoomTextOnly, True)
        #self.settings().setAttribute(QWebSettings.SiteSpecificQuirksEnabled, False)
        self.userFindText = QString()
        # Look for pqHelp.html in the app folder and copy its text into
        # a local buffer. If it isn't found, put a message there instead.
        # We need to keep it in order to implement the "back" function.
        helpPath = os.path.join(IMC.appBasePath,u'pqHelp.html')
        helpFile = QFile(helpPath)
        if not helpFile.exists():
            self.HTMLstring = QString('''<p>Unable to locate pqHelp.html.</p>
	    <p>Looking in {0}'''.format(helpPath)
                                )
        elif not helpFile.open(QIODevice.ReadOnly) :
            self.HTMLstring = QString('''<p>Unable to open pqHelp.html.</p>
	    <p>Looking in {0}</p><p>Error code {1}</p>'''.format(helpPath,
                                                                 helpFile.error())
                                                         )
        else:
            helpStream = QTextStream(helpFile)
            helpStream.setCodec('ISO8859-1')
            self.HTMLstring = helpStream.readAll()
        self.setHtml(self.HTMLstring)
Пример #47
0
 def load_appearance_config(self):
     w = self.widgets
     if self.appearance_config:
         #navigate around.. this could be tricky
         c = self.appearance_config
         if c.get("font_family", None):
             f = QFont()
             f.setFamily(c["font_family"])
             w.font.setCurrentFont(f)
         if c.get("font_size", None):
             log_warn("setting font size to ", c["font_size"])
             w.fontsize.setValue(c["font_size"])
             w.input.setFontPointSize(c["font_size"])
         if c.get("font_color", None): self._choosecolor(set_color=QColor(c["font_color"]))
         if c.get("font_bold", False): w.bold.setChecked(True)
         if c.get("font_italic", False): w.italic.setChecked(True)
         if c.get("font_underline", False): w.underline.setChecked(True)
         if c.get("show_joinpart", False): w.actionShow_Join_Leave.setChecked(True)
         
         self.use_relsize = c.get("use_html_relsize", False)
Пример #48
0
    def __init__(self, parent):
        self.parent = parent
        super(PythonConsoleWidget, self).__init__('Python Console',
                                                  parent=parent)
        #super(QDockWidget, self).__init__('Python Console', parent=parent) # I think this works by accident in qt4/5

        self.listMenu = QMenu()
        self.execute_python_button = QPushButton('Execute')
        self.execute_and_clear_python_button = QPushButton('Execute and Clear')

        if is_pygments and is_scintilla:
            #self.enter_data = QSyntaxHighlighting()
            self.enter_data = SimplePythonEditorWidget()
        else:
            self.enter_data = QTextEdit()
            font = QFont()
            font.setFamily('Courier')
            self.enter_data.setFont(font)
        self.setup_connections()
        self.layout()
    def __init__(self, parent):
        QFrame.__init__(self, parent)
        #         self.frame_WindIA = QFrame(parent)
        horizontalLayout_100 = QHBoxLayout(self)
        horizontalLayout_100.setSpacing(0)
        horizontalLayout_100.setContentsMargins(0, 0, 0, 0)
        horizontalLayout_100.setObjectName("horizontalLayout_100")
        self.txtSurface = QLineEdit(self)
        self.txtSurface.setObjectName("txtSurface")
        font = QFont()
        font.setFamily("Arial")
        self.txtSurface.setFont(font)

        horizontalLayout_100.addWidget(self.txtSurface)

        self.txtResult = QLineEdit(self)
        self.txtResult.setObjectName("txtOCHResults")
        self.txtResult.setFont(font)

        horizontalLayout_100.addWidget(self.txtResult)
Пример #50
0
    def __init__(self, parent=None):
        super(helpDisplay, self).__init__(parent)
        # make page unmodifiable
        self.page().setContentEditable(False)
        # initialize settings
        # Find out the nearest font to Palatino
        qf = QFont()
        qf.setStyleStrategy(QFont.PreferAntialias + QFont.PreferMatch)
        qf.setStyleHint(QFont.Serif)
        qf.setFamily(QString(u'Palatino'))
        qfi = QFontInfo(qf)
        # set the default font to that serif font
        self.settings().setFontFamily(QWebSettings.StandardFont, qfi.family())
        self.settings().setFontSize(QWebSettings.DefaultFontSize, 16)
        self.settings().setFontSize(QWebSettings.MinimumFontSize, 6)
        self.settings().setFontSize(QWebSettings.MinimumLogicalFontSize, 6)
        self.textZoomFactor = 1.0
        self.setTextSizeMultiplier(self.textZoomFactor)
        self.settings().setAttribute(QWebSettings.JavascriptEnabled, False)
        self.settings().setAttribute(QWebSettings.JavaEnabled, False)
        self.settings().setAttribute(QWebSettings.PluginsEnabled, False)
        self.settings().setAttribute(QWebSettings.ZoomTextOnly, True)
        #self.settings().setAttribute(QWebSettings.SiteSpecificQuirksEnabled, False)
        self.userFindText = QString()
        # Look for pqHelp.html in the app folder and copy its text into
        # a local buffer. If it isn't found, put a message there instead.
        # We need to keep it in order to implement the "back" function.
        helpPath = os.path.join(IMC.appBasePath, u'pqHelp.html')
        helpFile = QFile(helpPath)
        if not helpFile.exists():
            self.HTMLstring = QString('''<p>Unable to locate pqHelp.html.</p>
	    <p>Looking in {0}'''.format(helpPath))
        elif not helpFile.open(QIODevice.ReadOnly):
            self.HTMLstring = QString('''<p>Unable to open pqHelp.html.</p>
	    <p>Looking in {0}</p><p>Error code {1}</p>'''.format(
                helpPath, helpFile.error()))
        else:
            helpStream = QTextStream(helpFile)
            helpStream.setCodec('ISO8859-1')
            self.HTMLstring = helpStream.readAll()
        self.setHtml(self.HTMLstring)
Пример #51
0
def tuple_to_qfont(tup):
    """
    Create a QFont from tuple:
        (family [string], size [int], italic [bool], bold [bool])
    """
    if (
        not isinstance(tup, tuple)
        or len(tup) != 4
        or not font_is_installed(tup[0])
        or not isinstance(tup[1], int)
        or not isinstance(tup[2], bool)
        or not isinstance(tup[3], bool)
    ):
        return None
    font = QFont()
    family, size, italic, bold = tup
    font.setFamily(family)
    font.setPointSize(size)
    font.setItalic(italic)
    font.setBold(bold)
    return font
    def __init__(self, parent, diffText):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)

        self.vBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)

        self.browser.append(diffText)
        self.browser.verticalScrollBar().setValue(
            self.browser.verticalScrollBar().minimum())

        cursor = self.browser.textCursor()
        cursor.setPosition(0)
        self.browser.setTextCursor(cursor)

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.browser.setFont(font)

        self.vBoxSizer.addWidget(self.browser)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        buttonBox.accepted.connect(self.accept)
        self.vBoxSizer.addWidget(buttonBox)

        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Diff"))

        screen = QDesktopWidget().screenGeometry()
        wd = screen.width() / 4
        ht = screen.height() / 3
        self.resize(wd, ht)
        self.show()
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)
        #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.vBoxSizer = QVBoxLayout()
        self.hBoxSizer = QVBoxLayout()
        self.browser = QTextBrowser()
        self.browser.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        self.anotherFortuneButton = QPushButton(self.tr("One More!"), self)
        self.anotherFortuneButton.clicked.connect(
            self.onClickAnotherFortuneButton)
        self.hBoxSizer.addWidget(self.anotherFortuneButton)

        idx = random.choice(range(len(self.prm['appData']['fortunesList'])))

        self.browser.append(self.prm['appData']['fortunesList'][idx]['quote'])
        self.browser.append('\n')
        self.browser.append(self.prm['appData']['fortunesList'][idx]['author'])
        self.browser.append("In:" +
                            self.prm['appData']['fortunesList'][idx]['source'])

        font = QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.browser.setFont(font)

        self.vBoxSizer.addWidget(self.browser)
        self.vBoxSizer.addLayout(self.hBoxSizer)
        #self.vBoxSizer.setSizeConstraint(QLayout.SetFixedSize)

        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("pychoacoustics - fortunes"))
        self.resize(450, 450)
        self.show()
    def __init__(self, databaseFile, lastMathML, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.ui = Ui_PatternEditorWindow()
        self.ui.setupUi(self)

        # Make the fonts bigger
        font = QFont()
        font.setPointSize(12)
        font.setFamily('Consolas')
        font.setFixedPitch(True)
        self.ui.databaseEditor.setFont(font)
        self.ui.mathmlEditor.setFont(font)

        self.currentFile = databaseFile.strip()

        # If I actually got something, then let's load the file in
        if len(self.currentFile) > 0:
            try:
                f = open(self.currentFile, 'r')
                contents = f.read()
                f.close()
                self.ui.databaseEditor.setText(contents)
            except IOError:
                print 'Database file doesn\'t exist! Resetting to nothing...'
                self.currentFile = ''

        try:
            self.mathTTS = MathTTS(databaseFile)
        except Exception:
            self.mathTTS = None

#         self.stagesModel = QStandardItemModel()
#         self.stageTrees = []
#         self.updateStagesModel()

        self.ui.mathmlEditor.setText(unicode(lastMathML))

        self.connect_signals()
Пример #55
0
    def __init__(self, parent = None):
        QDialog.__init__(self)

        self.setObjectName(("ui_ProjectMngForm"))
        self.resize(200, 200)
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.setFont(font)
        self.setWindowTitle("Register AIP Chat")

        self.vlForm = QVBoxLayout(self)
        self.vlForm.setObjectName(("vl_ProjectMngForm"))
        self.vlForm.setSpacing(9)
        self.vlForm.setMargin(9)

        self.basicFrame = Frame(self)
        self.vlForm.addWidget(self.basicFrame)

        self.groubox = GroupBox(self.basicFrame)
        self.groubox.Caption = "Select a project"
        self.basicFrame.Add = self.groubox

        self.listBoxAIPChart = ListBox(self.groubox)
        self.groubox.Add = self.listBoxAIPChart

        self.textNameAIPChart = TextBoxPanel(self.basicFrame)
        self.textNameAIPChart.Caption = "Name"
        self.textNameAIPChart.LabelWidth = 50
        self.textNameAIPChart.Width = 120
        self.basicFrame.Add = self.textNameAIPChart

        self.textPathAIPChart = TextBoxPanel(self.basicFrame)
        self.textPathAIPChart.Caption = "Path"
        self.textPathAIPChart.imageButton.setIcon(QIcon())
        self.textPathAIPChart.Button = "opens.png"
        self.textPathAIPChart.LabelWidth = 50
        self.textPathAIPChart.textBox.setMaximumWidth(10000)
        self.textPathAIPChart.textBox.setMinimumWidth(100)
        self.basicFrame.Add = self.textPathAIPChart

        self.btnFrame = Frame(self.basicFrame, "HL")
        self.basicFrame.Add = self.btnFrame

        self.buttonAddAIPChart = QPushButton(self.btnFrame)
        self.buttonAddAIPChart.setObjectName("buttonAddAIPChart")
        self.buttonAddAIPChart.setText("Add")
        self.btnFrame.Add = self.buttonAddAIPChart

        self.buttonModifyAIPChart = QPushButton(self.btnFrame)
        self.buttonModifyAIPChart.setObjectName("buttonModifyAIPChart")
        self.buttonModifyAIPChart.setText("Modify")
        self.btnFrame.Add = self.buttonModifyAIPChart

        self.buttonDeleteAIPChart = QPushButton(self.btnFrame)
        self.buttonDeleteAIPChart.setObjectName("buttonDeleteAIPChart")
        self.buttonDeleteAIPChart.setText("Delete")
        self.btnFrame.Add = self.buttonDeleteAIPChart

        self.buttonSaveAIPChart = QPushButton(self.btnFrame)
        self.buttonSaveAIPChart.setObjectName("buttonSaveAIPChart")
        self.buttonSaveAIPChart.setText("Save")
        self.buttonSaveAIPChart.setVisible(False)
        self.btnFrame.Add = self.buttonSaveAIPChart

        self.buttonCloseAIPChart = QPushButton(self.btnFrame)
        self.buttonCloseAIPChart.setObjectName("buttonCloseAIPChart")
        self.buttonCloseAIPChart.setText("Close")
        self.btnFrame.Add = self.buttonCloseAIPChart

        self.connect(self.listBoxAIPChart, SIGNAL("Event_0"), self.listBoxProject_SelectedIndexChanged)
        self.connect(self.textPathAIPChart, SIGNAL("Event_1"), self.buttonBrowseProject_Click)

        self.buttonAddAIPChart.clicked.connect(self.buttonAddProject_Click)
        self.buttonModifyAIPChart.clicked.connect(self.buttonModifyProject_Click)
        self.buttonDeleteAIPChart.clicked.connect(self.buttonDeleteProject_Click)
        self.buttonSaveAIPChart.clicked.connect(self.buttonSaveProject_Click)
        self.buttonCloseAIPChart.clicked.connect(self.buttonCloseProject_Click)
        
        for pi in AirCraftOperation.g_projectList.ProjectsList:
            if (pi.Pt == enumProjectType.ptAipChart):
                self.listBoxAIPChart.Add(pi.Name)
    def __init__(self):
        """Widget creator."""

        super().__init__()

        # Other attributes...
        self.inputSeg = None
        self.morphology = dict()
        self.selectedMainWord = None
        self.mainWords = list()
        self.selectedParse = None
        self.parses = list()
        self.selectedStemForParse = None
        self.stemsForParse = list()
        self.selectedSuffixForParse = None
        self.suffixesForParse = list()
        self.selectedMainSignature = None
        self.mainSignatures = list()
        self.wordsForSig = list()
        self.stemsForSig = list()
        self.suffixesForSig = list()

        # Next two instructions are helpers from TextableUtils. Corresponding
        # interface elements are declared here and actually drawn below (at
        # their position in the UI)...
        self.infoBox = InfoBox(widget=self.controlArea)
        self.sendButton = SendButton(
            widget=self.controlArea,
            master=self,
            callback=self.sendData,
            infoBoxAttribute="infoBox",
            sendIfPreCallback=None,
        )

        # User interface...

        # A) Control area...

        # Options box...
        optionsBox = gui.widgetBox(
            widget=self.controlArea,
            box="Options",
            orientation="vertical",
        )
        gui.spin(
            widget=optionsBox,
            master=self,
            value='minStemLen',
            label='Minimum length of stems: ',
            callback=self.sendButton.sendIf,
            labelWidth=180,
            tooltip=(
                'Select the minimum number of required characters in stems'),
            minv=LOWER_MIN_STEM_LEN,
            maxv=MAX_MORPH_LEN,
            step=1,
        )
        gui.separator(widget=optionsBox, height=2)

        gui.rubber(self.controlArea)

        # B) Main area...

        font = QFont()
        font.setFamily('Courier')
        font.setStyleHint(QFont.Courier)
        font.setPixelSize(12)

        # Tabs...
        self.tabs = QTabWidget()
        self.wordTab = QWidget()
        self.signatureTab = QWidget()
        self.tabs.addTab(self.wordTab, "Words")
        self.tabs.addTab(self.signatureTab, "Signatures")

        # Words tab...
        wordTabBox = QHBoxLayout()
        wordBox = gui.widgetBox(
            widget=self.wordTab,
            orientation="horizontal",
            margin=5,
        )

        wordBoxRight = gui.widgetBox(widget=wordBox)

        self.mainWordListbox = gui.listBox(
            widget=wordBoxRight,
            master=self,
            value="selectedMainWord",
            labels="mainWords",
            callback=self.mainWordSelected,
            tooltip="Select a word to display its possible parses.",
        )
        self.mainWordListbox.setFont(font)

        gui.separator(widget=wordBox, width=3)

        wordBoxLeft = gui.widgetBox(widget=wordBox)

        gui.label(
            widget=wordBoxLeft,
            master=self,
            label="Parse(s):",
        )

        self.parsesListbox = gui.listBox(
            widget=wordBoxLeft,
            master=self,
            value="selectedParse",
            labels="parses",
            callback=self.parseSelected,
            tooltip="Select a parse to display the corresponding signature.",
        )
        self.parsesListbox.setFont(font)

        self.sigForParseBox = gui.widgetBox(
            widget=wordBoxLeft,
            box="Signature",
        )

        gui.label(
            widget=self.sigForParseBox,
            master=self,
            label="Stem(s):",
        )

        self.stemsForParseListbox = gui.listBox(
            widget=self.sigForParseBox,
            master=self,
            labels="stemsForParse",
            tooltip="Stems associated with the parse selected above.",
        )

        gui.separator(widget=self.sigForParseBox, height=2)

        gui.label(
            widget=self.sigForParseBox,
            master=self,
            label="Suffixes(s):",
        )

        self.suffixesForParseListbox = gui.listBox(
            widget=self.sigForParseBox,
            master=self,
            labels="suffixesForParse",
            tooltip="Suffixes associated with the parse selected above.",
        )

        wordTabBox.addWidget(wordBox)
        self.wordTab.setLayout(wordTabBox)

        # Signature tab...
        signatureTabBox = QHBoxLayout()

        signatureBox = gui.widgetBox(
            widget=self.signatureTab,
            orientation="horizontal",
            margin=5,
        )

        signatureBoxRight = gui.widgetBox(widget=signatureBox)

        self.mainSignatureListbox = gui.listBox(
            widget=signatureBoxRight,
            master=self,
            value="selectedMainSignature",
            labels="mainSignatures",
            callback=self.mainSignatureSelected,
            tooltip="Select a signature to display its contents.",
        )
        self.mainSignatureListbox.setFont(font)

        gui.separator(widget=signatureBox, width=3)

        signatureBoxLeft = gui.widgetBox(widget=signatureBox)

        gui.label(
            widget=signatureBoxLeft,
            master=self,
            label="Words:",
        )

        self.wordsForSigListbox = gui.listBox(
            widget=signatureBoxLeft,
            master=self,
            labels="wordsForSig",
            tooltip="Words associated with the selected signature.",
        )
        self.wordsForSigListbox.setFont(font)

        gui.label(
            widget=signatureBoxLeft,
            master=self,
            label="Stem(s):",
        )

        self.stemsForSigListbox = gui.listBox(
            widget=signatureBoxLeft,
            master=self,
            labels="stemsForSig",
            tooltip="Stems associated with the selected signature.",
        )
        self.stemsForSigListbox.setFont(font)

        gui.label(
            widget=signatureBoxLeft,
            master=self,
            label="Suffixes(s):",
        )

        self.suffixesForSigListbox = gui.listBox(
            widget=signatureBoxLeft,
            master=self,
            labels="suffixesForSig",
            tooltip="Suffixes associated with the selected signature.",
        )
        self.suffixesForSigListbox.setFont(font)

        signatureTabBox.addWidget(signatureBox)
        self.signatureTab.setLayout(signatureTabBox)

        self.mainArea.layout().addWidget(self.tabs)

        # Now Info box and Send button must be drawn...
        self.sendButton.draw()
        self.infoBox.draw()
        self.infoBox.setText("Widget needs input", "warning")

        self.setMinimumWidth(602)
        self.setMinimumHeight(317)
        self.adjustSizeWithTimer()

        # Send data if autoSend.
        self.sendButton.sendIf()