Esempio n. 1
0
    def init_font_config(self):
        self.disasm_font = QFont("DejaVu Sans Mono", 10)
        font_metrics = QFontMetricsF(self.disasm_font)
        self.disasm_font_height = font_metrics.height()
        self.disasm_font_width = font_metrics.width('A')
        self.disasm_font_ascent = font_metrics.ascent()

        self.symexec_font = QFont("DejaVu Sans Mono", 10)
        font_metrics = QFontMetricsF(self.symexec_font)
        self.symexec_font_height = font_metrics.height()
        self.symexec_font_width = font_metrics.width('A')
        self.symexec_font_ascent = font_metrics.ascent()
Esempio n. 2
0
    def __init__(self, main_window):

        self._main_window = main_window
        self._instance = None
        self.views_by_category = defaultdict(list)
        self.views = []
        self.dockable_views = []
        self.view_to_dockable = {}

        #
        # Some generic configurations. move to "configurations" module later
        #
        #self.disasm_font = QFont("courier new", 20)
        self.disasm_font = QFont("DejaVu Sans Mono", 10)
        font_metrics = QFontMetricsF(self.disasm_font)
        self.disasm_font_height = font_metrics.height()
        self.disasm_font_width = font_metrics.width('A')
        self.disasm_font_ascent = font_metrics.ascent()

        default_tabs = [
            FunctionsView(self, 'left'),
            DisassemblyView(self, 'right'),
            SymexecView(self, 'right'),
            StatesView(self, 'right'),
            StringsView(self, 'right'),
            ConsoleView(self, 'bottom'),
        ]

        for tab in default_tabs:
            self.add_view(tab, tab.caption, tab.category)
Esempio n. 3
0
 def sizeHint(self):
     """
     Return the size hint of the widget (depends on the editor font)
     """
     s = str(self.editor.codeEdit.blockCount())
     fm = QFontMetricsF(self.font)
     # +1 needed on window xp! (not needed on seven nor on GNU/Linux)
     return QSize(fm.width('A') * (len(s) + 1), 0)
Esempio n. 4
0
 def __paintMargin(self, event):
     """ Paints the right margin as postPainting step. """
     rect = event.rect()
     font = self.editor.codeEdit.currentCharFormat().font()
     fm = QFontMetricsF(font)
     pos = self.marginPos
     offset = self.editor.codeEdit.contentOffset().x() + \
              self.editor.codeEdit.document().documentMargin()
     x80 = round(fm.width(' ') * pos) + offset
     p = QPainter(self.editor.codeEdit.viewport())
     p.setPen(self.pen)
     p.drawLine(x80, rect.top(), x80, rect.bottom())