+#
+# Copyright 2013 Thadeu Lima de Souza Cascardo <cascardo@cascardo.info>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# -*- mode: python; encoding: utf-8; -*-
+
+import os
+
+class IRPFDir:
+ def __init__(self, resource_dir, userdata_dir):
+ self.resource_dir = resource_dir
+ self.userdata_dir = userdata_dir
+ def get_resource_dir(self):
+ return self.resource_dir
+ def get_userdata_dir(self):
+ return self.userdata_dir
+ def get_resource_file(self, file):
+ return self.get_resource_dir() + file
+ def get_userdata_file(self, file):
+ return self.get_userdata_dir() + file
+
+class IRPFDevelDir(IRPFDir):
+ def __init__(self):
+ self.resource_dir = "res/"
+ self.userdata_dir = "aplicacao/dados/"
+
+class IRPFInstallDir(IRPFDir):
+ def __init__(self):
+ self.resource_dir = "/usr/share/irpflivre/res/"
+ self.userdata_dir = os.path.expanduser("~/.irpflivre/aplicacao/dados/")
+
+default_irpf_dir = None
+
+def set_default_irpf_dir(dir):
+ default_irpf_dir = dir
+
+def get_default_irpf_dir():
+ global default_irpf_dir
+ if default_irpf_dir == None:
+ default_irpf_dir = IRPFDevelDir()
+ return default_irpf_dir
+
+# vim:tabstop=4:expandtab:smartindent