Skip to content

Commit

Permalink
Fix some gui landscape errors
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Nov 12, 2015
1 parent 335f4fa commit b7820cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion malcolm/__init__.py
Expand Up @@ -5,7 +5,7 @@
pass
try:
from malcolm.gui.gui import gui, probe
except:
except ImportError:
print "No Qt available"
import malcolm.devices
import malcolm.personalities
9 changes: 4 additions & 5 deletions malcolm/gui/delegate.py
Expand Up @@ -8,7 +8,6 @@ class MState(Enum):
Normal, Hovered, Pressed = range(3)



class Delegate(QStyledItemDelegate):

def paint(self, painter, option, index):
Expand All @@ -35,12 +34,13 @@ def paint(self, painter, option, index):
opt.state |= QStyle.State_MouseOver
opt.rect = option.rect
opt.text = index.internalPointer().name
style.drawControl(QStyle.CE_PushButton, opt, painter, self.blue_button)
style.drawControl(QStyle.CE_PushButton, opt, painter,
self.blue_button)
else:
if option.state & QStyle.State_Selected:
# Don't show delegates as highlighted
option.state = option.state ^ QStyle.State_Selected
super(Delegate, self).paint(painter, option, index)
QStyledItemDelegate.paint(self, painter, option, index)

def method_allowed(self, item):
sm = getattr(item.data.device, "stateMachine", None)
Expand All @@ -55,5 +55,4 @@ def editorEvent(self, event, model, option, index):
if self.method_allowed(index.internalPointer()):
model.setData(index, 0)
return True
return super(QStyledItemDelegate, self).editorEvent(event, model,
option, index)
QStyledItemDelegate.editorEvent(self, event, model, option, index)
4 changes: 2 additions & 2 deletions malcolm/gui/guimodel.py
Expand Up @@ -15,7 +15,7 @@
class GuiModel(QAbstractItemModel):

def __init__(self, device, probe=False):
super(GuiModel, self).__init__()
QAbstractItemModel.__init__(self)
# map ob.name -> GuiItem instance
self.probe = probe
self.device_items = {}
Expand Down Expand Up @@ -249,7 +249,7 @@ def run_method(self, index, **args):
self.dataChanged.emit(index, index)

def flags(self, index):
flags = super(GuiModel, self).flags(index)
flags = QAbstractItemModel.flags(self, index)
if index.isValid() and index.column() == 1:
item = index.internalPointer()
if self.isArgument(item) or isinstance(item.data, Method):
Expand Down

0 comments on commit b7820cc

Please sign in to comment.