Esempio n. 1
0
    def __init__(self):
        wx.Frame.__init__(self, None, -1, title=_('TreeDo'), size=(350, 500))
        self.SetMinSize((300, 300))
        self.CenterOnParent()

        self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
        self.toolbar.SetToolBitmapSize((24, 24))

        save_img =  wx.Bitmap('res/save.png', wx.BITMAP_TYPE_PNG)
        add_img =  wx.Bitmap('res/add.png', wx.BITMAP_TYPE_PNG)
        add_sub_img =  wx.Bitmap('res/add_subtask.png', wx.BITMAP_TYPE_PNG)
        collapse_img =  wx.Bitmap('res/collapse.png', wx.BITMAP_TYPE_PNG)
        expand_img =  wx.Bitmap('res/expand.png', wx.BITMAP_TYPE_PNG)
        delete_img =  wx.Bitmap('res/delete.png', wx.BITMAP_TYPE_PNG)

        self.toolbar.AddSimpleTool(wx.ID_SAVE, save_img, _('Save Task List'), _('Save the task list to the hard drive'))
        self.toolbar.AddSimpleTool(ID_ADD_TASK, add_img, _('Add Task'), _('Create a new task'))
        self.toolbar.AddSimpleTool(ID_ADD_SUBTASK, add_sub_img, _('Add Sub-Task'), _('Create a new subtask'))
        #self.toolbar.AddSimpleTool(ID_COLLAPSE, collapse_img, _('Collapse'), _('Collapse all tasks'))
        self.toolbar.AddSimpleTool(ID_EXPAND, expand_img, _('Expand'), _('Expand all tasks'))
        self.toolbar.AddSimpleTool(wx.ID_DELETE, delete_img, _('Delete'), _('Delete this task'))

        self.Bind(wx.EVT_TOOL, self.OnToolClick)
        self.toolbar.Realize()

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.tree = TaskList(self)
        sizer.Add(self.tree, 1, wx.EXPAND)

        self.Bind(wx.EVT_SIZE, self.UpdateColumnWidths)
        self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.ToggleToolbarButtons)

        self.tree.SetTasks(DATA.get_list())
        self.ToggleToolbarButtons()
Esempio n. 2
0
    def Persist(self):
        """Persists the task list to the filesystem"""

        DATA.persist(self.tree.root)