Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hamster-gtk work with latest version of hamster-lib #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hamster_gtk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = 'Eric Goller'
__email__ = '[email protected]'
__version__ = '0.11.0'
__version__ = '0.11.1'
15 changes: 8 additions & 7 deletions hamster_gtk/hamster_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
from hamster_gtk.helpers import get_parent_window, get_resource_path
from six import text_type

# [FIXME]
# Remove once hamster-lib has been patched
from hamster_gtk.helpers import get_config_instance
from hamster_gtk.misc import HamsterAboutDialog as AboutDialog
from hamster_gtk.overview import OverviewDialog
from hamster_gtk.preferences import PreferencesDialog
Expand Down Expand Up @@ -174,6 +171,9 @@ def __init__(self):
"""Setup instance and make sure default signals are connected to methods."""
super(HamsterGTK, self).__init__()
self.window = None

self._appdirs = config_helpers.HamsterAppDirs('hamster-gtk')

# Which config backend to use.
self.config_store = 'file'
# Yes this is redundent, but more transparent. And we can worry about
Expand All @@ -195,7 +195,7 @@ def save_config(self, config):
dict: Dictionary of config keys and values.
"""
cp_instance = self._config_to_configparser(config)
config_helpers.write_config_file(cp_instance, 'hamster-gtk', 'hamster-gtk.conf')
config_helpers.write_config_file(cp_instance, self._appdirs, 'hamster-gtk.conf')
self.controler.signal_handler.emit('config-changed')

def _startup(self, app):
Expand Down Expand Up @@ -249,7 +249,7 @@ def _get_default_config(self):

Note: Those defaults are independend of the particular config store.
"""
appdirs = config_helpers.HamsterAppDirs('hamster-gtk')
appdirs = self._appdirs
return {
# Backend
'store': 'sqlalchemy',
Expand Down Expand Up @@ -362,7 +362,7 @@ def _write_config_to_file(self, configparser_instance):
Args:
cp_instance (SafeConfigParser): Instance to be written to file.
"""
config_helpers.write_config_file(configparser_instance, 'hamster-gtk', 'hamster-gtk.conf')
config_helpers.write_config_file(configparser_instance, self._appdirs, 'hamster-gtk.conf')

def _get_config_from_file(self):
"""
Expand All @@ -380,7 +380,8 @@ def get_fallback():
config = self._get_default_config()
return self._config_to_configparser(config)

cp_instance = get_config_instance(get_fallback(), 'hamster-gtk', 'hamster-gtk.conf')
cp_instance = config_helpers.load_config_file(self._appdirs, 'hamster-gtk.conf',
get_fallback())
return self._configparser_to_config(cp_instance)


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.11.0
current_version = 0.11.1
commit = True
tag = False

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
history = history_file.read().replace('.. :changelog:', '')

requirements = [
'hamster-lib',
'orderedset',
'hamster-lib >=0.13.0,<0.14.0',
]

setup(
name='hamster-gtk',
version='0.11.0',
version='0.11.1',
description="A GTK interface to the hamster time tracker.",
long_description=readme + '\n\n' + history,
author="Eric Goller",
Expand Down