Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg 2 # 3 # This file is part of Timeline. 4 # 5 # Timeline 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. 9 # 10 # Timeline 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. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with Timeline. If not, see <http://www.gnu.org/licenses/>. 17 18 19 import wx 20 21 import timelinelib.wxgui.utils as gui_utils 22 from timelinelib.wxgui.utils import BORDER 23 from timelinelib.wxgui.components.cattree import CategoriesTree 24 from timelinelib.wxgui.components.cattree import add_category 25 from timelinelib.wxgui.components.cattree import edit_category 26 from timelinelib.wxgui.components.cattree import delete_category 27 2830 """ 31 Dialog used to edit categories of a timeline. 32 33 The edits happen immediately. In other words: when the dialog is closing 34 all edits have been applied already. 35 """ 3613138 wx.Dialog.__init__(self, parent, title=_("Edit Categories")) 39 self.db = timeline 40 self.cat_tree = self._create_gui() 41 self._fill_controls_with_data()42 4547 vbox = wx.BoxSizer(wx.VERTICAL) 48 cat_tree = self._create_cat_tree(vbox) 49 self._create_buttons(vbox) 50 self.SetSizerAndFit(vbox) 51 self.Bind(wx.EVT_CLOSE, self._window_on_close) 52 return cat_tree53 5759 cat_tree = CategoriesTree(self, self.db_error_handler) 60 cat_tree.SetMinSize((-1, 200)) 61 self.Bind(wx.EVT_TREE_SEL_CHANGED, self._cat_tree_on_sel_changed, 62 cat_tree) 63 vbox.Add(cat_tree, flag=wx.ALL|wx.EXPAND, border=BORDER) 64 return cat_tree65 68 76 8385 selected_category = self.cat_tree.get_selected_category() 86 if selected_category is not None: 87 edit_category(self, self.db, selected_category, 88 self.db_error_handler) 89 self._updateButtons()90 96 100 107109 selected_category = self.cat_tree.get_selected_category() 110 if selected_category is not None: 111 delete_category(self, self.db, selected_category, 112 self.db_error_handler) 113 self._updateButtons()114 120 123125 gui_utils.handle_db_error_in_dialog(self, e)126128 selected_category = self.cat_tree.get_selected_category() is not None 129 self.btn_edit.Enable(selected_category) 130 self.btn_del.Enable(selected_category)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Aug 3 03:56:58 2013 | http://epydoc.sourceforge.net |