add CacheFile
This commit is contained in:
parent
77f54ad3b6
commit
a09b4e0446
2
setup.py
2
setup.py
@ -9,6 +9,6 @@ setup(name = "simplesvnbrowser",
|
||||
license = "zlib",
|
||||
packages = ["simplesvnbrowser"],
|
||||
zip_safe = False,
|
||||
|
||||
scripts = ["bin/simple-svn-browser"],
|
||||
install_requires = ["pyxdg"],
|
||||
)
|
||||
|
20
simplesvnbrowser/cache_file.py
Normal file
20
simplesvnbrowser/cache_file.py
Normal file
@ -0,0 +1,20 @@
|
||||
import xdg.BaseDirectory
|
||||
import os
|
||||
|
||||
class CacheFile:
|
||||
params = None
|
||||
|
||||
def __init__(self):
|
||||
if CacheFile.params is None:
|
||||
CacheFile.params = {}
|
||||
cfp = self.__cache_file_path()
|
||||
if os.path.exists(cfp):
|
||||
with open(cfp, "r") as f:
|
||||
cache_content = f.read()
|
||||
exec(cache_content, CacheFile.params)
|
||||
|
||||
def __cache_dir(self):
|
||||
return xdg.BaseDirectory.save_cache_path("simple-svn-browser")
|
||||
|
||||
def __cache_file_path(self):
|
||||
return os.path.join(self.__cache_dir(), "settings")
|
@ -3,11 +3,14 @@ gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from .version import VERSION
|
||||
from .run_svn import run_svn
|
||||
from .cache_file import CacheFile
|
||||
|
||||
class MainWindow(Gtk.Window):
|
||||
def __init__(self, url):
|
||||
super().__init__(title = "Simple SVN Browser v%s" % VERSION)
|
||||
|
||||
self.cache_file = CacheFile()
|
||||
|
||||
top_hbox = Gtk.Box()
|
||||
address_entry = Gtk.Entry(text = url)
|
||||
go_button = Gtk.Button(label = "Go")
|
||||
|
Loading…
x
Reference in New Issue
Block a user