def __init__(self, file: FileProxy, snippetManager: SnippetManager, tooltipManager: TooltipManager): super(CodeEditor, self).__init__() # podaci vezani za asmeblerski fajl self.file: FileProxy = file self.setPlainText(self.file.text) self.labelPositions = dict() self.labelVisitStack = Stack() self.previousKeywordFormat = {'cursor': None, 'format': None} self.lastFind = None # snipeti self.snippetManager = snippetManager self.tooltipManager = tooltipManager self.setLineWrapMode(QPlainTextEdit.NoWrap) self.tabSize = 4 self.autocompleteWidgetOpen = False self.queryWord = "" self.widget = None self.instructionsTrie = Trie() self.insertInstructionsInTrie() self.setMouseTracking(True) # self.setTabStopWidth(self.fontMetrics().width(" ") * self.tabSize) self.setStyleSheet( "font-size: 14px; background-color: #1E1E1E; color: white; font-family: comic-sans; border: none;" ) # if isinstance(self.file, AssemblyFileProxy): # self.sintaksa = AsemblerSintaksa(self.document()) # else: # self.sintaksa = CSyntax(self.document()) self.lineNumberArea = QLineNumberArea(self) self.blockCountChanged.connect(self.updateLineNumberAreaWidth) self.updateRequest.connect(self.updateLineNumberArea) self.cursorPositionChanged.connect(self.highlightCurrentLine) self.updateLineNumberAreaWidth(0) self.textChanged.connect(self.checkForUnsavedChanges) palette = QToolTip.palette() palette.setColor(QPalette.ToolTipBase, QColor("#2D2D30")) palette.setColor(QPalette.ToolTipText, QColor("#FFFFFF")) QToolTip.setPalette(palette)
def setup_tool_tip_style(): tool_tip_palette = QToolTip.palette() tool_tip_palette.setColor(QPalette.ToolTipBase, QColor("#FFFFFF")) tool_tip_palette.setColor(QPalette.ToolTipText, QColor("#505050")) QToolTip.setPalette(tool_tip_palette)