2
Task Coach - Your friendly task manager
3
Copyright (C) 2004-2014 Task Coach developers <developers@taskcoach.org>
5
Task Coach is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
10
Task Coach is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program. If not, see <http://www.gnu.org/licenses/>.
20
from taskcoachlib.thirdparty.squaremap import squaremap
24
class SquareMap(tooltip.ToolTipMixin, squaremap.SquareMap):
25
def __init__(self, parent, rootNode, onSelect, onEdit, popupMenu):
27
self.getItemTooltipData = parent.getItemTooltipData
28
super(SquareMap, self).__init__(parent, model=rootNode, adapter=parent,
31
self.__tip = tooltip.SimpleToolTip(self)
32
self.selectCommand = onSelect
33
self.Bind(squaremap.EVT_SQUARE_SELECTED, self.onSelect)
34
self.editCommand = onEdit
35
self.Bind(squaremap.EVT_SQUARE_ACTIVATED, self.onEdit)
36
self.popupMenu = popupMenu
37
self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup)
39
def RefreshAllItems(self, count): # pylint: disable=W0613
42
def RefreshItems(self, *args): # pylint: disable=W0613
45
def onSelect(self, event):
46
if event.node == self.model:
49
self.__selection = [event.node]
50
wx.CallAfter(self.selectCommand)
53
def select(self, items):
56
def onEdit(self, event):
57
self.editCommand(event)
60
def OnBeforeShowToolTip(self, x, y):
61
item = squaremap.HotMapNavigator.findNodeAtPosition(self.hot_map, (x,y))
62
if item is None or item == self.model:
64
tooltipData = self.getItemTooltipData(item)
65
doShow = reduce(operator.__or__,
66
map(bool, [data[1] for data in tooltipData]),
69
self.__tip.SetData(tooltipData)
74
def onPopup(self, event):
75
self.OnClickRelease(event) # Make sure the node is selected
77
self.PopupMenu(self.popupMenu)
79
def curselection(self):
80
return self.__selection
82
def GetItemCount(self):
85
def isAnyItemExpandable(self):
88
isAnyItemCollapsable = isAnyItemExpandable
90
def GetMainWindow(self):
93
MainWindow = property(GetMainWindow)