Skip to content

Commit

Permalink
Refactored callers of OnClick
Browse files Browse the repository at this point in the history
  • Loading branch information
lfdversluis committed Jul 5, 2016
1 parent 192691e commit a7b7407
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Tribler/Main/vwxGUI/list_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ def GetColumn(self, column):
return self.data[column]

@warnWxThread
@inlineCallbacks
# TODO (Laurens): Refactor callers because deferred.
def OnMouse(self, event):
if event.Entering():
event.GetEventObject().selected = True
Expand All @@ -456,7 +458,7 @@ def OnMouse(self, event):

elif event.LeftUp():
if getattr(self.parent_list.lastMouseLeftDownEvent, 'listitem', None) == self:
self.OnClick(event)
yield self.OnClick(event)

elif event.RightUp():
self.OnRightClick(event)
Expand All @@ -478,7 +480,6 @@ def OnMouse(self, event):

@warnWxThread
@inlineCallbacks
# TODO (Laurens): Refactor callers because deferred.
def OnClick(self, event=None, force=False):
if not self.expanded or force:
expanded = yield self.parent_list.OnExpand(self)
Expand All @@ -501,9 +502,11 @@ def OnDClick(self, event=None):
pass

@warnWxThread
@inlineCallbacks
# TODO (Laurens): Refactor callers because deferred.
def DoExpand(self):
if not self.expanded:
self.OnClick()
yield self.OnClick()

@warnWxThread
def Expand(self, panel):
Expand Down Expand Up @@ -1306,7 +1309,7 @@ def Select(self, key, raise_event=True, force=False):
yield self.DeselectAll()

if raise_event:
self.items[key].OnClick(None, force=force)
yield self.items[key].OnClick(None, force=force)
else:
self.items[key].expanded = True
self.cur_expanded = self.items[key]
Expand Down
4 changes: 3 additions & 1 deletion Tribler/Main/vwxGUI/list_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ def RefreshData(self, data):
self.icons[index].Show(False)

@warnWxThread
@inlineCallbacks
# TODO (Laurens): Refactor callers because deferred.
def OnRightClick(self, event=None):
mousepos = wx.GetMousePosition()
if not self.expanded:
self.OnClick(event)
yield self.OnClick(event)

def do_menu():
menu = self.GetContextMenu()
Expand Down

0 comments on commit a7b7407

Please sign in to comment.