Пример #1
0
 def on_menu_reset(self, event):
     yes = utils.make_yesno_dlg(_(u'Are you sure you want to reset?'),
                                _(u'Are you sure?'))
     if yes:
         configs.load(self, app.get_real_path('default.cfg'))
         self.picker.view.path.SetValue(u'')
         self.picker.clear_all()
Пример #2
0
    def __init__(self, parent):
        self.__init_ctrls(parent)
        self.Center(wx.HORIZONTAL | wx.VERTICAL)

        # the base path
        docspath = app.get_real_path(u'help')

        # the notebook tabs
        notebookTabs = (self.htmlWindow1, self.htmlWindow2, self.htmlWindow3,
                        self.htmlWindow4, self.htmlWindow5)
        # the helpfiles
        helpFiles = [u'general_help.html', u'picker_help.html', u'main_help.html',
            u'numbering_help.html', u'date_time_help.html']

        # fix for fonts too big in gtk:
        if u'gtk2' in wx.PlatformInfo:
            for tab in notebookTabs:
                tab.SetStandardFonts()

        # try to load the right file for the language, on fail default to US english
        i = 0
        for helpfile in helpFiles:
            if os.path.isfile(os.path.join(docspath, app.language, helpfile)):
                helpFiles[i] = os.path.join(docspath, app.language, helpfile)
            else:
                helpFiles[i] = os.path.join(docspath, u'en_US', helpfile)
            i += 1

        # display the file
        i = 0
        for tab in notebookTabs:
            tab.LoadPage(helpFiles[i])
            i += 1
Пример #3
0
    def __init__(self, parent):
        self.__init_ctrls(parent)
        self.Center(wx.HORIZONTAL | wx.VERTICAL)

        # the base path
        docspath = app.get_real_path(u'help')

        # the notebook tabs
        notebookTabs = (self.htmlWindow1, self.htmlWindow2, self.htmlWindow3,
                        self.htmlWindow4, self.htmlWindow5)
        # the helpfiles
        helpFiles = [u'general_help.html', u'picker_help.html', u'main_help.html',
            u'numbering_help.html', u'date_time_help.html']

        # fix for fonts too big in gtk:
        if u'gtk2' in wx.PlatformInfo:
            for tab in notebookTabs:
                tab.SetStandardFonts()

        # try to load the right file for the language, on fail default to US english
        i = 0
        for helpfile in helpFiles:
            if os.path.isfile(os.path.join(docspath, app.language, helpfile)):
                helpFiles[i] = os.path.join(docspath, app.language, helpfile)
            else:
                helpFiles[i] = os.path.join(docspath, u'en_US', helpfile)
            i += 1

        # display the file
        i = 0
        for tab in notebookTabs:
            tab.LoadPage(helpFiles[i])
            i += 1
Пример #4
0
    def __load_preferences(self):
        """
        Get values from file (one way or another)
        """
        prefFile = self.__find_pref_file()
        app.debug_print("Try to load preferences from file")
        # make sure the file exist and is filled:
        if not os.path.exists(prefFile) or os.path.getsize(prefFile) < 5:
            app.debug_print("File does not exist or is empty: Using default preferences")
            prefFile = app.get_real_path(os.path.join('preferences', 'default.ini'))
        self.prefFilePath = prefFile
        prefs = self.__read_file(prefFile)

        # windows-compatible?
        if platform.system() != 'Windows':
            win_compatible = False
        if prefs.get(u'useWinChars', win_compatible):
            prefs[u'bad_chars'] = (u'\\', u'/', u':', u'*', u'?', u'"', u'>', u'<', u'|')
        if prefs.get(u'useWinNames', win_compatible):
            prefs[u'bad_win_words'] = (u'con', u'prn', u'aux', u'clock$',
                                       u'nul', u'com1', u'com2', u'com3', u'com4', u'com5', u'com6', u'com7',
                                       u'com8', u'com9', u'lpt1', u'lpt2', u'lpt3', u'lpt4', u'lpt5', u'lpt6',
                                       u'lpt7', u'lpt8', u'lpt9')

        prefs[u'backgroundColor'] = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        prefs[u'highlightColor'] = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)
        prefs[u'highlightTextColor'] = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)
        prefs[u'textColor'] = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
        app.debug_print("Loaded %s preferences" % len(prefs))
        self.prefs = prefs
Пример #5
0
    def __init__(self, prnt, helpFile, title, icon, size=False):

        if size == False:
            size = wx.Size(610, 531)
        wx.Dialog.__init__(self, id=-1, name='smallHelpDialog', parent=prnt,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX,
                           title=title)
        self.SetIcon(wx.Icon(utils.icon_path(u'%s.ico') % icon, wx.BITMAP_TYPE_ICO))

        self.display = wx.html.HtmlWindow(id=-1,
                                          name=u'display', parent=self, style=wx.html.HW_SCROLLBAR_AUTO)
        #self.display.SetMinSize(wx.Size(1010, 531))

        self.Center(wx.HORIZONTAL | wx.VERTICAL)

        if u'gtk2' in wx.PlatformInfo:
            self.display.SetStandardFonts()

        docspath = app.get_real_path(u'help')

        if os.path.isfile(os.path.join(docspath, app.language, helpFile)):
            helpFile = os.path.join(docspath, app.language, helpFile)
        else:
            helpFile = os.path.join(docspath, u'en_US', helpFile)

        self.display.LoadPage(helpFile)
        self.SetSize(size)
        self.CentreOnParent()
Пример #6
0
    def __init__(self, prnt, helpFile, title, icon, size=False):

        if size == False:
            size = wx.Size(610, 531)
        wx.Dialog.__init__(self,
                           id=-1,
                           name='smallHelpDialog',
                           parent=prnt,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX,
                           title=title)
        self.SetIcon(
            wx.Icon(utils.icon_path(u'%s.ico') % icon, wx.BITMAP_TYPE_ICO))

        self.display = wx.html.HtmlWindow(id=-1,
                                          name=u'display',
                                          parent=self,
                                          style=wx.html.HW_SCROLLBAR_AUTO)
        #self.display.SetMinSize(wx.Size(1010, 531))

        self.Center(wx.HORIZONTAL | wx.VERTICAL)

        if u'gtk2' in wx.PlatformInfo:
            self.display.SetStandardFonts()

        docspath = app.get_real_path(u'help')

        if os.path.isfile(os.path.join(docspath, app.language, helpFile)):
            helpFile = os.path.join(docspath, app.language, helpFile)
        else:
            helpFile = os.path.join(docspath, u'en_US', helpFile)

        self.display.LoadPage(helpFile)
        self.SetSize(size)
        self.CentreOnParent()
Пример #7
0
def icon_path(icon):
    """Get the full icon path."""
    return app.get_real_path(u'icons/%s' % icon)
Пример #8
0
 def on_menu_reset(self, event):
     yes = utils.make_yesno_dlg(_(u'Are you sure you want to reset?'), _(u'Are you sure?'))
     if yes:
         configs.load(self, app.get_real_path('default.cfg'))
         self.picker.view.path.SetValue(u'')
         self.picker.clear_all()
Пример #9
0
            langFile = codecs.open(utils.get_user_path(u'language.ini'), 'w', 'utf-8')
        except IOError, error:
            utils.make_err_msg(unicode(error), u"Error")
            pass
        else:
            langFile.write(language)
            langFile.close()
        if event:
            msg = _(u"\n\nYou will need to restart Metamorphose to change the language.")
            msg += _(u"\n\nClose out of Metamorphose now?")
            msg = language + msg
            title = _(u"Change the Language")
            # Restart app automatically if not in windows
            if utils.make_yesno_dlg(msg, title):
                if platform.system() != 'Windows':
                    if wx.Process.Open(app.get_real_path(sys.argv[0])):
                        self.Close()
                else:
                    self.Close()

    def set_status_msg(self, msg, img):
        """Set status bar text and image."""
        self.statusImage.SetBitmap(self.statusImages[img])
        self.SetStatusText(self.make_space(msg))
        app.debug_print(u"status message: '%s'" % msg)

#
#--- MENU ACTIONS: -----------------------------------------------------------#
#

    def on_menu_exit(self, event):
Пример #10
0
            langFile = codecs.open(utils.get_user_path(u'language.ini'), 'w', 'utf-8')
        except IOError, error:
            utils.make_err_msg(unicode(error), u"Error")
            pass
        else:
            langFile.write(language)
            langFile.close()
        if event:
            msg = _(u"\n\nYou will need to restart Metamorphose to change the language.")
            msg += _(u"\n\nClose out of Metamorphose now?")
            msg = language + msg
            title = _(u"Change the Language")
            # Restart app automatically if not in windows
            if utils.make_yesno_dlg(msg, title):
                if platform.system() != 'Windows':
                    if wx.Process.Open(app.get_real_path(sys.argv[0])):
                        self.Close()
                else:
                    self.Close()

    def set_status_msg(self, msg, img):
        """Set status bar text and image."""
        self.statusImage.SetBitmap(self.statusImages[img])
        self.SetStatusText(self.make_space(msg))
        app.debug_print(u"status message: '%s'" % msg)

#
#--- MENU ACTIONS: -----------------------------------------------------------#
#

    def on_menu_exit(self, event):
Пример #11
0
def icon_path(icon):
    """Get the full icon path."""
    return app.get_real_path(u'icons/%s' % icon)