예제 #1
0
 def __init__(self, model, *args, **kwargs):
     self.model = model
     super(Model, self).__init__(*args, **kwargs)
     self.console = Console(self, model)
     self.setToolTip(str(self.model))
     self.highlighted = False
     self.stdout_n_lines = 0
예제 #2
0
class Model(object):

    def __init__(self, model, *args, **kwargs):
        self.model = model
        super(Model, self).__init__(*args, **kwargs)
        self.console = Console(self, model)
        self.setToolTip(str(self.model))
        self.highlighted = False
        self.stdout_n_lines = 0

    @property
    def console_offset(self):
        return self.console.scenePos() - self.scenePos()

    @property
    def console_size(self):
        return self.console.size()

    def mouseDoubleClickEvent(self, ev):
        self.console.enabled = not self.console.enabled

    def toggle(self, what):
        if what == 'console enabled':
            self.console.enabled = not self.console.enabled
        elif what == 'console visible':
            self.console.visible = not self.console.visible
        elif what == 'console frame':
            self.console.has_frame = not self.console.has_frame

    def refresh(self):
        n_lines = len(self.model.stdout)
        if n_lines != self.stdout_n_lines:
            self.highlighted = True
            self.stdout_n_lines = n_lines
        self.console.refresh()

    def itemChange(self, change, val):
        if change == QGraphicsItem.ItemPositionChange:
            val = super(Model, self).itemChange(change, val)
            offset = val - self.pos()
            self.console.moveBy(offset.x(), offset.y())
            return val
        return super(Model, self).itemChange(change, val)
예제 #3
0
 def __init__(self, model, *args, **kwargs):
     self.model = model
     super(Model, self).__init__(*args, **kwargs)
     self.console = Console(model)
     self.setToolTip(str(self.model))
예제 #4
0
 def __init__(self, model, *args, **kwargs):
     self.model = model
     super(Model, self).__init__(*args, **kwargs)
     self.console = Console(model)
     self.setToolTip(str(self.model))