コード例 #1
0
 def install(cls, import_defaults=True):
     "create templates dir on plugin installation"
     logger.debug("installing xsl plugin")
     container_dir = os.path.join(paths.appdata_dir(), "templates")
     if not os.path.exists(container_dir):
         os.mkdir(container_dir)
     cls.plugin_dir = os.path.join(paths.appdata_dir(), "templates", "xsl")
     if not os.path.exists(cls.plugin_dir):
         os.mkdir(cls.plugin_dir)
コード例 #2
0
ファイル: __init__.py プロジェクト: Ghini/ghini.desktop
 def install(cls, import_defaults=True):
     "create templates dir on plugin installation"
     logger.debug("installing xsl plugin")
     container_dir = os.path.join(paths.appdata_dir(), "templates")
     if not os.path.exists(container_dir):
         os.mkdir(container_dir)
     cls.plugin_dir = os.path.join(paths.appdata_dir(), "templates", "xsl")
     if not os.path.exists(cls.plugin_dir):
         os.mkdir(cls.plugin_dir)
コード例 #3
0
 def set_filename(self, filename):
     if not filename:
         self._filename = None
         self.dialog.set_filename('')
         self.dialog.set_current_folder(paths.appdata_dir())
         self.props.label = self._default_label
     else:
         self._filename = filename
         head, tail = os.path.split(self._filename)
         self.dialog.set_filename(self._filename)
         self.props.label = tail
コード例 #4
0
ファイル: __init__.py プロジェクト: Ghini/ghini.desktop
 def set_filename(self, filename):
     if not filename:
         self._filename = None
         self.dialog.set_filename('')
         self.dialog.set_current_folder(paths.appdata_dir())
         self.props.label = self._default_label
     else:
         self._filename = filename
         head, tail = os.path.split(self._filename)
         self.dialog.set_filename(self._filename)
         self.props.label = tail
コード例 #5
0
 def get_params(self, new=None):
     if new is not None:
         self.dbtype = 'SQLite'
         self.use_defaults = True
     if self.dbtype == 'SQLite':
         if self.use_defaults is True:
             name = new or self.connection_name
             self.filename = os.path.join(
                 paths.appdata_dir(), name + '.db')
             self.pictureroot = os.path.join(
                 paths.appdata_dir(), name)
         result = {'file': self.filename,
                   'default': self.use_defaults,
                   'pictures': self.pictureroot}
     else:
         result = {'db': self.database,
                   'host': self.host,
                   'user': self.user,
                   'pictures': self.pictureroot,
                   'passwd': self.passwd,
                   }
     result['type'] = self.dbtype
     return result
コード例 #6
0
 def __init__(self, dialog_parent):
     super(FileChooserButton, self).__init__(self._default_label)
     self._filename = False
     self.props.use_underline = False
     self.props.xalign = 0
     self.dialog = \
         gtk.FileChooserDialog(title=_('Select a stylesheet'),
                               parent=dialog_parent,
                               buttons=(
                                   gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                                   gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
     self.dialog.set_select_multiple(False)
     self.dialog.set_current_folder(paths.appdata_dir())
     self.dialog.connect('response', self._on_response)
     self.connect('clicked', self._on_clicked)
コード例 #7
0
ファイル: __init__.py プロジェクト: Ghini/ghini.desktop
 def __init__(self, dialog_parent):
     super(FileChooserButton, self).__init__(self._default_label)
     self._filename = False
     self.props.use_underline = False
     self.props.xalign = 0
     self.dialog = \
         gtk.FileChooserDialog(title=_('Select a stylesheet'),
                               parent=dialog_parent,
                               buttons=(
                                   gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                                   gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
     self.dialog.set_select_multiple(False)
     self.dialog.set_current_folder(paths.appdata_dir())
     self.dialog.connect('response', self._on_response)
     self.connect('clicked', self._on_clicked)
コード例 #8
0
ファイル: prefs.py プロジェクト: watermelon337/ghini.desktop
using a dictionary like interface. e.g. ::

    import bauble.prefs
    prefs.prefs[key] = value
"""

# TODO: maybe we should have a create method that creates the preferences
# todo a one time thing if the files doesn't exist

# TODO: Consider using ConfigObj since it does validation, type
# conversion and unicode automatically...the cons are that it adds
# another dependency and we would have to change the prefs interface
# throughout bauble

default_filename = 'config'
default_prefs_file = os.path.join(paths.appdata_dir(), default_filename)
"""
The default file for the preference settings file.
"""

config_version_pref = 'bauble.config.version'
"""
The preferences key for the bauble version of the preferences file.
"""

config_version = bauble.version_tuple[0], bauble.version_tuple[1]

date_format_pref = 'bauble.default_date_format'
"""
The preferences key for the default data format.
"""
コード例 #9
0
 def on_help_menu_logfile(self, widget, data=None):
     filename = os.path.join(paths.appdata_dir(), 'bauble.log')
     desktop.open(filename, dialog_on_error=True)
コード例 #10
0
ファイル: prefs.py プロジェクト: Ghini/ghini.desktop
using a dictionary like interface. e.g. ::

    import bauble.prefs
    prefs.prefs[key] = value
"""

# TODO: maybe we should have a create method that creates the preferences
# todo a one time thing if the files doesn't exist

# TODO: Consider using ConfigObj since it does validation, type
# conversion and unicode automatically...the cons are that it adds
# another dependency and we would have to change the prefs interface
# throughout bauble

default_filename = 'config'
default_prefs_file = os.path.join(paths.appdata_dir(), default_filename)
"""
The default file for the preference settings file.
"""

config_version_pref = 'bauble.config.version'
"""
The preferences key for the bauble version of the preferences file.
"""

config_version = bauble.version_tuple[0], bauble.version_tuple[1]

date_format_pref = 'bauble.default_date_format'
"""
The preferences key for the default data format.
"""
コード例 #11
0
ファイル: __init__.py プロジェクト: Ghini/ghini.desktop
    """
    # TODO: it would be nice to show a Tk dialog here saying we can't
    # import gtk...but then we would have to include all of the Tk libs in
    # with the win32 batteries-included installer
    try:
        import gtk
        import gobject
    except ImportError, e:
        print _('** Error: could not import gtk and/or gobject')
        print e
        if sys.platform == 'win32':
            print _('Please make sure that GTK_ROOT\\bin is in your PATH.')
        sys.exit(1)

    # create the user directory
    if not os.path.exists(paths.appdata_dir()):
        os.makedirs(paths.appdata_dir())

    # add console root handler, and file root handler, set it at the logging
    # level specified by BAUBLE_LOGGING, or at INFO level.
    filename = os.path.join(paths.appdata_dir(), 'bauble.log')
    formatter = logging.Formatter(
        '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    fileHandler = logging.FileHandler(filename, 'w+')
    logging.getLogger().addHandler(fileHandler)
    consoleHandler = logging.StreamHandler()
    logging.getLogger().addHandler(consoleHandler)
    fileHandler.setFormatter(formatter)
    consoleHandler.setFormatter(formatter)
    fileHandler.setLevel(logging.DEBUG)
    consoleHandler.setLevel(consoleLevel)
コード例 #12
0
    """
    # TODO: it would be nice to show a Tk dialog here saying we can't
    # import gtk...but then we would have to include all of the Tk libs in
    # with the win32 batteries-included installer
    try:
        import gtk
        import gobject
    except ImportError, e:
        print _('** Error: could not import gtk and/or gobject')
        print e
        if sys.platform == 'win32':
            print _('Please make sure that GTK_ROOT\\bin is in your PATH.')
        sys.exit(1)

    # create the user directory
    if not os.path.exists(paths.appdata_dir()):
        os.makedirs(paths.appdata_dir())

    # add console root handler, and file root handler, set it at the logging
    # level specified by BAUBLE_LOGGING, or at INFO level.
    filename = os.path.join(paths.appdata_dir(), 'bauble.log')
    formatter = logging.Formatter(
        '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    fileHandler = logging.FileHandler(filename, 'w+')
    logging.getLogger().addHandler(fileHandler)
    consoleHandler = logging.StreamHandler()
    logging.getLogger().addHandler(consoleHandler)
    fileHandler.setFormatter(formatter)
    consoleHandler.setFormatter(formatter)
    fileHandler.setLevel(logging.DEBUG)
    consoleHandler.setLevel(consoleLevel)