Exemplo n.º 1
0
    def show_page(self, id, type="page", change_history=True):
        """
        Where which is a tuple (type, id):

          * (page, page_id)
          * (search, search_string)
        """
        if self.help_system is None:
            display_error_message(
                _("Could not find markdown Python package. It is needed by the help system."),
                self.GetParent())
            return
        if change_history:
            same_page_as_last = False
            if self.current_pos != -1:
                _, current_id = self.history[self.current_pos]
                if id == current_id:
                    same_page_as_last = True
            if same_page_as_last is False:
                self.history = self.history[:self.current_pos + 1]
                self.history.append((type, id))
                self.current_pos += 1
        self._update_buttons()
        if type == "page":
            self.html_window.SetPage(self._generate_page(id))
        elif type == "search":
            self.html_window.SetPage(self.help_system.get_search_results_page(id))
        self.Show()
        self.Raise()
Exemplo n.º 2
0
    def show_page(self, id, type="page", change_history=True):
        """
        Where which is a tuple (type, id):

          * (page, page_id)
          * (search, search_string)
        """
        if self.help_system is None:
            display_error_message(
                _("Could not find markdown Python package.  It is needed by the help system. See the Timeline website or the doc/installing.rst file for instructions how to install it."
                  ), self.GetParent())
            return
        if change_history:
            same_page_as_last = False
            if self.current_pos != -1:
                current_type, current_id = self.history[self.current_pos]
                if id == current_id:
                    same_page_as_last = True
            if same_page_as_last == False:
                self.history = self.history[:self.current_pos + 1]
                self.history.append((type, id))
                self.current_pos += 1
        self._update_buttons()
        if type == "page":
            self.html_window.SetPage(self._generate_page(id))
        elif type == "search":
            self.html_window.SetPage(
                self.help_system.get_search_results_page(id))
        self.Show()
        self.Raise()
Exemplo n.º 3
0
 def save(self):
     category = self.view.get_category()
     if not self._category_is_given(category) and self.selected_event_ids == []:
         display_error_message(_("You must select a category!"))
     else:
         self._save_category_in_events(category)
         self.view.close()
Exemplo n.º 4
0
 def save(self):
     category = self.view.get_category()
     if not self._category_is_given(
             category) and self.selected_event_ids == []:
         display_error_message(_("You must select a category!"))
     else:
         self._save_category_in_events(category)
         self.view.close()
Exemplo n.º 5
0
 def ok_button_clicked(self, evt):
     try:
         if self.view.GetTime() is None:
             raise ValueError(_("Invalid date"))
     except ValueError as ex:
         display_error_message(ex_msg(ex))
     else:
         self.view.Close()
Exemplo n.º 6
0
 def _set_milestone_time_period(self):
     try:
         t = self.view.GetTime()
         if t is None:
             raise DateTimeError()
         self._milestone.set_time_period(TimePeriod(t, t))
     except:
         display_error_message(_("You can't save a milestone with an invalid date/time"))
         raise(DateTimeError())
Exemplo n.º 7
0
 def on_return(self):
     try:
         self.time = self.time_picker.get_value()
         if not self.checkbox.IsChecked():
             gt = gregorian.from_time(self.time)
             gt.hour = 12
             self.time = gt.to_time()
     except ValueError, ex:
         display_error_message(ex_msg(ex))
Exemplo n.º 8
0
 def on_return(self):
     try:
         self.time = self.time_picker.get_value()
         if not self.checkbox.IsChecked():
             gt = gregorian.from_time(self.time)
             gt.hour = 12
             self.time = gt.to_time()
     except ValueError, ex:
         display_error_message(ex_msg(ex))
Exemplo n.º 9
0
 def _save_application_config(self):
     self.config.set_window_size(self.GetSize())
     self.config.set_window_pos(self.GetPosition())
     self.config.window_maximized = self.IsMaximized()
     self.config.sidebar_width = self.main_panel.get_sidebar_width()
     try:
         self.config.write()
     except IOError as ex:
         friendly = _("Unable to write configuration file.")
         msg = "%s\n\n%s" % (friendly, ex_msg(ex))
         display_error_message(msg, self)
Exemplo n.º 10
0
 def _save_application_config(self):
     self.config.set_window_size(self.GetSize())
     self.config.set_window_pos(self.GetPosition())
     self.config.window_maximized = self.IsMaximized()
     self.config.sidebar_width = self.main_panel.get_sidebar_width()
     try:
         self.config.write()
     except IOError as ex:
         friendly = _("Unable to write configuration file.")
         msg = "%s\n\n%s" % (friendly, ex_msg(ex))
         display_error_message(msg, self)
Exemplo n.º 11
0
 def _period_for_all_visible_events(self):
     try:
         visible_events = self._all_visible_events()
         if len(visible_events) > 0:
             start = self._first_time(visible_events)
             end = self._last_time(visible_events)
             return TimePeriod(start, end).zoom(-1)
         else:
             return None
     except ValueError as ex:
         display_error_message(ex.message)
     return None
Exemplo n.º 12
0
 def _period_for_all_visible_events(self):
     try:
         visible_events = self._all_visible_events()
         if len(visible_events) > 0:
             start = self._first_time(visible_events)
             end = self._last_time(visible_events)
             return TimePeriod(start, end).zoom(-1)
         else:
             return None
     except ValueError as ex:
         display_error_message(str(ex))
     return None
Exemplo n.º 13
0
 def ok_button_clicked(self, evt):
     try:
         time = self.view.GetTime()
         if time is None:
             raise ValueError(_("Invalid date"))
         if self.time_type.is_date_time_type():
             if not self.view.ShowTimeIsChecked():
                 gt = self.time_type.get_utils().from_time(time)
                 gt.hour = 12
                 self.view.SetTime(gt.to_time())
     except ValueError, ex:
         display_error_message(ex_msg(ex))
Exemplo n.º 14
0
 def ok_button_clicked(self, evt):
     try:
         time = self.view.GetTime()
         if time is None:
             raise ValueError(_("Invalid date"))
         if self.time_type.is_date_time_type():
             if not self.view.ShowTimeIsChecked():
                 gt = self.time_type.get_utils().from_time(time)
                 gt.hour = 12
                 self.view.SetTime(gt.to_time())
     except ValueError, ex:
         display_error_message(ex_msg(ex))
Exemplo n.º 15
0
 def run(self, main_frame):
     if not has_pysvg_module():
         display_error_message(_("Could not find pysvg Python package. It is needed to export to SVG."), self)
         return
     helper = WildcardHelper(_("SVG files"), ["svg"])
     wildcard = helper.wildcard_string()
     dialog = wx.FileDialog(main_frame, message=_("Export to SVG"), wildcard=wildcard, style=wx.FD_SAVE)
     if dialog.ShowModal() == wx.ID_OK:
         path = helper.get_path(dialog)
         overwrite_question = _("File '%s' exists. Overwrite?") % path
         if (not os.path.exists(path) or _ask_question(overwrite_question, main_frame) == wx.YES):
             main_frame.main_panel.timeline_panel.timeline_canvas.SaveAsSvg(path)
     dialog.Destroy()
Exemplo n.º 16
0
 def run(self, main_frame):
     if not has_pysvg_module():
         display_error_message(_("Could not find pysvg Python package. It is needed to export to SVG."), self)
         return
     helper = WildcardHelper(_("SVG files"), ["svg"])
     wildcard = helper.wildcard_string()
     dialog = wx.FileDialog(main_frame, message=_("Export to SVG"), wildcard=wildcard, style=wx.FD_SAVE)
     if dialog.ShowModal() == wx.ID_OK:
         path = helper.get_path(dialog)
         overwrite_question = _("File '%s' exists. Overwrite?") % path
         if (not os.path.exists(path) or _ask_question(overwrite_question, main_frame) == wx.YES):
             scene = main_frame.main_panel.get_scene()
             view_properties = main_frame.main_panel.get_view_properties()
             export(path, scene, view_properties)
     dialog.Destroy()
Exemplo n.º 17
0
 def _date_button_on_click(self, evt):
     try:
         wx_date = self.controller.date_tuple_to_wx_date(self.date_picker.get_value())
         calendar_popup = CalendarPopup(self, wx_date, self.config)
         calendar_popup.Bind(wx.calendar.EVT_CALENDAR_SEL_CHANGED,
                             self._calendar_on_date_changed)
         calendar_popup.Bind(wx.calendar.EVT_CALENDAR,
                             self._calendar_on_date_changed_dclick)
         btn = evt.GetEventObject()
         pos = btn.ClientToScreen((0,0))
         sz = btn.GetSize()
         calendar_popup.Position(pos, (0, sz[1]))
         calendar_popup.Popup()
         self.calendar_popup = calendar_popup
     except ValueError:
         display_error_message(_("Invalid date"))
Exemplo n.º 18
0
 def _date_button_on_click(self, evt):
     try:
         wx_date = self.controller.date_tuple_to_wx_date(
             self.date_picker.get_value())
         calendar_popup = CalendarPopup(self, wx_date, self.config)
         calendar_popup.Bind(wx.calendar.EVT_CALENDAR_SEL_CHANGED,
                             self._calendar_on_date_changed)
         calendar_popup.Bind(wx.calendar.EVT_CALENDAR,
                             self._calendar_on_date_changed_dclick)
         btn = evt.GetEventObject()
         pos = btn.ClientToScreen((0, 0))
         sz = btn.GetSize()
         calendar_popup.Position(pos, (0, sz[1]))
         calendar_popup.Popup()
         self.calendar_popup = calendar_popup
     except ValueError:
         display_error_message(_("Invalid date"))
Exemplo n.º 19
0
 def DisplayErrorMessage(self, message):
     display_error_message(message, parent=self)
Exemplo n.º 20
0
Arquivo: view.py Projeto: ncqgm/gnumed
 def DisplayInvalidName(self, message):
     display_error_message(message, self)
     _set_focus_and_select(self.txt_name)
Exemplo n.º 21
0
 def InvalidTargetDir(self, message):
     display_error_message(message)
     self.tb_target_dir.SetFocus()
Exemplo n.º 22
0
 def open_timeline_if_exists(self, path):
     if os.path.exists(path):
         self.open_timeline(path)
     else:
         display_error_message(
             _("File '%s' does not exist.") % path, self._main_frame)
Exemplo n.º 23
0
Arquivo: view.py Projeto: ncqgm/gnumed
 def InvalidTargetDir(self, message):
     display_error_message(message)
     self.tb_target_dir.SetFocus()
Exemplo n.º 24
0
 def display_invalid_name(self, message):
     display_error_message(message, self)
     _set_focus_and_select(self.txt_name)
Exemplo n.º 25
0
 def DisplayInvalidPeriod(self, message):
     guiutils.display_error_message(message, self)
Exemplo n.º 26
0
Arquivo: view.py Projeto: ncqgm/gnumed
 def HandleInvalidName(self, name):
     msg = _("Category name '%s' not valid. Must be non-empty.")
     display_error_message(msg % name, self)
     _set_focus_and_select(self.txt_name)
Exemplo n.º 27
0
 def _DisplayInvalidInput(self, message, control):
     guiutils.display_error_message(message, self)
     guiutils._set_focus_and_select(control)
Exemplo n.º 28
0
 def HandleUsedName(self, name):
     msg = _("Category name '%s' already in use.")
     display_error_message(msg % name, self)
     _set_focus_and_select(self.txt_name)
Exemplo n.º 29
0
 def HandleInvalidName(self, name):
     msg = _("Category name '%s' not valid. Must be non-empty.")
     display_error_message(msg % name, self)
     _set_focus_and_select(self.txt_name)
Exemplo n.º 30
0
 def _btn_copy_on_click(self, evt):
     if wx.TheClipboard.Open():
         self._copy_text_to_clipboard()
     else:
         display_error_message(_("Unable to copy to clipboard."))
Exemplo n.º 31
0
 def DisplayErrorMessage(self, message, focus_widget=None):
     display_error_message(message, parent=self)
     if focus_widget is not None:
         _set_focus_and_select(focus_widget)
Exemplo n.º 32
0
 def HandleDateErrors(self, error_count):
     display_error_message(
         _("%d Events not duplicated due to missing dates.")
         % error_count)
Exemplo n.º 33
0
 def open_timeline_if_exists(self, path):
     if os.path.exists(path):
         self.open_timeline(path)
     else:
         display_error_message(_("File '%s' does not exist.") % path, self._main_frame)
Exemplo n.º 34
0
Arquivo: view.py Projeto: ncqgm/gnumed
 def HandleUsedName(self, name):
     msg = _("Category name '%s' already in use.")
     display_error_message(msg % name, self)
     _set_focus_and_select(self.txt_name)
Exemplo n.º 35
0
 def HandleDateErrors(self, error_count):
     display_error_message(
         _("%d Events not duplicated due to missing dates.") % error_count)