{"action":"created","comment":{"url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/comments/33411700","id":33411700,"diff_hunk":"@@ -18,39 +18,50 @@\n along with this program.  If not, see <http://www.gnu.org/licenses/>\n \n \"\"\"\n-from gi.repository import Gdk\n+\n from base64 import b64encode, b64decode\n import ConfigParser\n-from defaults import ConfigDefaults\n import os\n \n-__terra_data_directory__ = '/usr/local/share/terra/'\n-__terra_app_directory__ = '/usr/local/share/applications/'\n-__version__ = '0.2.0'\n+from gi.repository import Gdk\n \n-class ConfigManager():\n-    config_dir_path = os.path.join(os.environ['HOME'], '.config', 'terra')\n-    config_file_path = os.path.join(config_dir_path, 'main.cfg')\n+from terra import (__version__)\n+from terra.defaults import ConfigDefaults\n+from terra.handler import TerraHandler\n+\n+\n+class ConfigManager:\n+    version = __version__\n+    config_file_name = 'main.cfg'\n \n-    config = ConfigDefaults\n-    config.read(config_file_path)\n     defaults = ConfigDefaults\n+    config = ConfigDefaults\n \n     callback_list = []\n     use_fake_transparency = False\n     disable_losefocus_temporary = False\n \n-    data_dir = __terra_data_directory__\n-    version = __version__\n+    @classmethod\n+    def __init__(cls):\n+        # Load the user config, if any.\n+        config_path = TerraHandler.get_config_path()\n+        if os.path.exists(config_path):\n+            config_file_path = os.path.join(config_path, cls.config_file_name)\n+            if os.path.exists(config_file_path):\n+                cls.config.read(config_file_path)\n \n-    @staticmethod\n-    def init():\n-        ConfigParser.SafeConfigParser({})\n-        ConfigManager.save_config()\n+        # TODO: Remove once the code no longer requires the config files!\n+        # Now save the config file.\n+        cls.save_config()\n \n-    @staticmethod\n-    def get_sections():\n-        return (ConfigManager.config.sections())\n+    @classmethod\n+    def get_sections(cls):\n+        # TODO: Remove! For some reason, on my setup the `sections()` method\n+        # raises a \"tuple assignment index out of range\" exception.\n+        # Reading items from the config seems to solve the issue.","path":"terra/config.py","position":63,"original_position":63,"commit_id":"c29d5bb910add8713a90e371f420ab22519632ef","original_commit_id":"6b655fcaf313abe200ad546565db2f38a90fc722","user":{"login":"SchnWalter","id":2186426,"avatar_url":"https://avatars.githubusercontent.com/u/2186426?v=3","gravatar_id":"","url":"https://api.github.com/users/SchnWalter","html_url":"https://github.com/SchnWalter","followers_url":"https://api.github.com/users/SchnWalter/followers","following_url":"https://api.github.com/users/SchnWalter/following{/other_user}","gists_url":"https://api.github.com/users/SchnWalter/gists{/gist_id}","starred_url":"https://api.github.com/users/SchnWalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchnWalter/subscriptions","organizations_url":"https://api.github.com/users/SchnWalter/orgs","repos_url":"https://api.github.com/users/SchnWalter/repos","events_url":"https://api.github.com/users/SchnWalter/events{/privacy}","received_events_url":"https://api.github.com/users/SchnWalter/received_events","type":"User","site_admin":false},"body":"I solved it on the new manager I created. Maybe I'll just commit it as `settings.py`.  The new one seems to work just fine, \r\n\r\nI replace the whole thing with this:\r\n```\r\n    @property\r\n    def sections(self):\r\n        \"\"\"\r\n        :return dict:\r\n        \"\"\"\r\n        sections_list = self._defaults.keys()\r\n        for section in self.iterkeys():\r\n            if section not in sections_list:\r\n                # Delete default values.\r\n                if sections_list[section] is None:\r\n                    del sections_list[section]\r\n                    continue\r\n\r\n                sections_list.append(section)\r\n\r\n        return sections_list\r\n```\r\nWhere that \"Delete default values\" part simply allows one to remove a whole section from the default settings, for example a layouts section. But it should not really be required to have such a thing, maybe I'll just remove it.","created_at":"2015-06-27T10:27:44Z","updated_at":"2015-06-27T10:27:44Z","html_url":"https://github.com/Sixdsn/terra-terminal/pull/78#discussion_r33411700","pull_request_url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/comments/33411700"},"html":{"href":"https://github.com/Sixdsn/terra-terminal/pull/78#discussion_r33411700"},"pull_request":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78","id":38497952,"html_url":"https://github.com/Sixdsn/terra-terminal/pull/78","diff_url":"https://github.com/Sixdsn/terra-terminal/pull/78.diff","patch_url":"https://github.com/Sixdsn/terra-terminal/pull/78.patch","issue_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/78","number":78,"state":"open","locked":false,"title":"Use Setuptools","user":{"login":"SchnWalter","id":2186426,"avatar_url":"https://avatars.githubusercontent.com/u/2186426?v=3","gravatar_id":"","url":"https://api.github.com/users/SchnWalter","html_url":"https://github.com/SchnWalter","followers_url":"https://api.github.com/users/SchnWalter/followers","following_url":"https://api.github.com/users/SchnWalter/following{/other_user}","gists_url":"https://api.github.com/users/SchnWalter/gists{/gist_id}","starred_url":"https://api.github.com/users/SchnWalter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchnWalter/subscriptions","organizations_url":"https://api.github.com/users/SchnWalter/orgs","repos_url":"https://api.github.com/users/SchnWalter/repos","events_url":"https://api.github.com/users/SchnWalter/events{/privacy}","received_events_url":"https://api.github.com/users/SchnWalter/received_events","type":"User","site_admin":false},"body":"Related to #77","created_at":"2015-06-24T23:17:00Z","updated_at":"2015-06-27T10:27:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d253d8e5d924c209705e51c5818f6e087d21484b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78/commits","review_comments_url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78/comments","review_comment_url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/78/comments","statuses_url":"https://api.github.com/repos/Sixdsn/terra-terminal/statuses/c29d5bb910add8713a90e371f420ab22519632ef","head":{"label":"Sixdsn:feature/setuptools--GH-77","ref":"feature/setuptools--GH-77","sha":"c29d5bb910add8713a90e371f420ab22519632ef","user":{"login":"Sixdsn","id":4504460,"avatar_url":"https://avatars.githubusercontent.com/u/4504460?v=3","gravatar_id":"","url":"https://api.github.com/users/Sixdsn","html_url":"https://github.com/Sixdsn","followers_url":"https://api.github.com/users/Sixdsn/followers","following_url":"https://api.github.com/users/Sixdsn/following{/other_user}","gists_url":"https://api.github.com/users/Sixdsn/gists{/gist_id}","starred_url":"https://api.github.com/users/Sixdsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sixdsn/subscriptions","organizations_url":"https://api.github.com/users/Sixdsn/orgs","repos_url":"https://api.github.com/users/Sixdsn/repos","events_url":"https://api.github.com/users/Sixdsn/events{/privacy}","received_events_url":"https://api.github.com/users/Sixdsn/received_events","type":"User","site_admin":false},"repo":{"id":14726914,"name":"terra-terminal","full_name":"Sixdsn/terra-terminal","owner":{"login":"Sixdsn","id":4504460,"avatar_url":"https://avatars.githubusercontent.com/u/4504460?v=3","gravatar_id":"","url":"https://api.github.com/users/Sixdsn","html_url":"https://github.com/Sixdsn","followers_url":"https://api.github.com/users/Sixdsn/followers","following_url":"https://api.github.com/users/Sixdsn/following{/other_user}","gists_url":"https://api.github.com/users/Sixdsn/gists{/gist_id}","starred_url":"https://api.github.com/users/Sixdsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sixdsn/subscriptions","organizations_url":"https://api.github.com/users/Sixdsn/orgs","repos_url":"https://api.github.com/users/Sixdsn/repos","events_url":"https://api.github.com/users/Sixdsn/events{/privacy}","received_events_url":"https://api.github.com/users/Sixdsn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sixdsn/terra-terminal","description":"Terra is a GTK+3.0 based terminal emulator with useful user interface, it also supports multiple terminals with splitting screen horizontally or vertically. New features have been added since September 2013. It's a pretty new and experimental project, if you want to contribute just checkout and try.","fork":true,"url":"https://api.github.com/repos/Sixdsn/terra-terminal","forks_url":"https://api.github.com/repos/Sixdsn/terra-terminal/forks","keys_url":"https://api.github.com/repos/Sixdsn/terra-terminal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sixdsn/terra-terminal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sixdsn/terra-terminal/teams","hooks_url":"https://api.github.com/repos/Sixdsn/terra-terminal/hooks","issue_events_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/events{/number}","events_url":"https://api.github.com/repos/Sixdsn/terra-terminal/events","assignees_url":"https://api.github.com/repos/Sixdsn/terra-terminal/assignees{/user}","branches_url":"https://api.github.com/repos/Sixdsn/terra-terminal/branches{/branch}","tags_url":"https://api.github.com/repos/Sixdsn/terra-terminal/tags","blobs_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sixdsn/terra-terminal/statuses/{sha}","languages_url":"https://api.github.com/repos/Sixdsn/terra-terminal/languages","stargazers_url":"https://api.github.com/repos/Sixdsn/terra-terminal/stargazers","contributors_url":"https://api.github.com/repos/Sixdsn/terra-terminal/contributors","subscribers_url":"https://api.github.com/repos/Sixdsn/terra-terminal/subscribers","subscription_url":"https://api.github.com/repos/Sixdsn/terra-terminal/subscription","commits_url":"https://api.github.com/repos/Sixdsn/terra-terminal/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sixdsn/terra-terminal/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sixdsn/terra-terminal/contents/{+path}","compare_url":"https://api.github.com/repos/Sixdsn/terra-terminal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sixdsn/terra-terminal/merges","archive_url":"https://api.github.com/repos/Sixdsn/terra-terminal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sixdsn/terra-terminal/downloads","issues_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues{/number}","pulls_url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls{/number}","milestones_url":"https://api.github.com/repos/Sixdsn/terra-terminal/milestones{/number}","notifications_url":"https://api.github.com/repos/Sixdsn/terra-terminal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sixdsn/terra-terminal/labels{/name}","releases_url":"https://api.github.com/repos/Sixdsn/terra-terminal/releases{/id}","created_at":"2013-11-26T19:29:33Z","updated_at":"2015-03-03T19:05:46Z","pushed_at":"2015-06-27T09:53:07Z","git_url":"git://github.com/Sixdsn/terra-terminal.git","ssh_url":"git@github.com:Sixdsn/terra-terminal.git","clone_url":"https://github.com/Sixdsn/terra-terminal.git","svn_url":"https://github.com/Sixdsn/terra-terminal","homepage":"","size":2486,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":13,"forks":4,"open_issues":13,"watchers":6,"default_branch":"develop"}},"base":{"label":"Sixdsn:develop","ref":"develop","sha":"3d0b8b0ce2cb79c181ec3a656e207da0121f369a","user":{"login":"Sixdsn","id":4504460,"avatar_url":"https://avatars.githubusercontent.com/u/4504460?v=3","gravatar_id":"","url":"https://api.github.com/users/Sixdsn","html_url":"https://github.com/Sixdsn","followers_url":"https://api.github.com/users/Sixdsn/followers","following_url":"https://api.github.com/users/Sixdsn/following{/other_user}","gists_url":"https://api.github.com/users/Sixdsn/gists{/gist_id}","starred_url":"https://api.github.com/users/Sixdsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sixdsn/subscriptions","organizations_url":"https://api.github.com/users/Sixdsn/orgs","repos_url":"https://api.github.com/users/Sixdsn/repos","events_url":"https://api.github.com/users/Sixdsn/events{/privacy}","received_events_url":"https://api.github.com/users/Sixdsn/received_events","type":"User","site_admin":false},"repo":{"id":14726914,"name":"terra-terminal","full_name":"Sixdsn/terra-terminal","owner":{"login":"Sixdsn","id":4504460,"avatar_url":"https://avatars.githubusercontent.com/u/4504460?v=3","gravatar_id":"","url":"https://api.github.com/users/Sixdsn","html_url":"https://github.com/Sixdsn","followers_url":"https://api.github.com/users/Sixdsn/followers","following_url":"https://api.github.com/users/Sixdsn/following{/other_user}","gists_url":"https://api.github.com/users/Sixdsn/gists{/gist_id}","starred_url":"https://api.github.com/users/Sixdsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sixdsn/subscriptions","organizations_url":"https://api.github.com/users/Sixdsn/orgs","repos_url":"https://api.github.com/users/Sixdsn/repos","events_url":"https://api.github.com/users/Sixdsn/events{/privacy}","received_events_url":"https://api.github.com/users/Sixdsn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sixdsn/terra-terminal","description":"Terra is a GTK+3.0 based terminal emulator with useful user interface, it also supports multiple terminals with splitting screen horizontally or vertically. New features have been added since September 2013. It's a pretty new and experimental project, if you want to contribute just checkout and try.","fork":true,"url":"https://api.github.com/repos/Sixdsn/terra-terminal","forks_url":"https://api.github.com/repos/Sixdsn/terra-terminal/forks","keys_url":"https://api.github.com/repos/Sixdsn/terra-terminal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sixdsn/terra-terminal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sixdsn/terra-terminal/teams","hooks_url":"https://api.github.com/repos/Sixdsn/terra-terminal/hooks","issue_events_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/events{/number}","events_url":"https://api.github.com/repos/Sixdsn/terra-terminal/events","assignees_url":"https://api.github.com/repos/Sixdsn/terra-terminal/assignees{/user}","branches_url":"https://api.github.com/repos/Sixdsn/terra-terminal/branches{/branch}","tags_url":"https://api.github.com/repos/Sixdsn/terra-terminal/tags","blobs_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sixdsn/terra-terminal/statuses/{sha}","languages_url":"https://api.github.com/repos/Sixdsn/terra-terminal/languages","stargazers_url":"https://api.github.com/repos/Sixdsn/terra-terminal/stargazers","contributors_url":"https://api.github.com/repos/Sixdsn/terra-terminal/contributors","subscribers_url":"https://api.github.com/repos/Sixdsn/terra-terminal/subscribers","subscription_url":"https://api.github.com/repos/Sixdsn/terra-terminal/subscription","commits_url":"https://api.github.com/repos/Sixdsn/terra-terminal/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sixdsn/terra-terminal/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sixdsn/terra-terminal/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sixdsn/terra-terminal/contents/{+path}","compare_url":"https://api.github.com/repos/Sixdsn/terra-terminal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sixdsn/terra-terminal/merges","archive_url":"https://api.github.com/repos/Sixdsn/terra-terminal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sixdsn/terra-terminal/downloads","issues_url":"https://api.github.com/repos/Sixdsn/terra-terminal/issues{/number}","pulls_url":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls{/number}","milestones_url":"https://api.github.com/repos/Sixdsn/terra-terminal/milestones{/number}","notifications_url":"https://api.github.com/repos/Sixdsn/terra-terminal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sixdsn/terra-terminal/labels{/name}","releases_url":"https://api.github.com/repos/Sixdsn/terra-terminal/releases{/id}","created_at":"2013-11-26T19:29:33Z","updated_at":"2015-03-03T19:05:46Z","pushed_at":"2015-06-27T09:53:07Z","git_url":"git://github.com/Sixdsn/terra-terminal.git","ssh_url":"git@github.com:Sixdsn/terra-terminal.git","clone_url":"https://github.com/Sixdsn/terra-terminal.git","svn_url":"https://github.com/Sixdsn/terra-terminal","homepage":"","size":2486,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":13,"forks":4,"open_issues":13,"watchers":6,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78"},"html":{"href":"https://github.com/Sixdsn/terra-terminal/pull/78"},"issue":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/78"},"comments":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/Sixdsn/terra-terminal/statuses/c29d5bb910add8713a90e371f420ab22519632ef"}}}}