mirror of
https://github.com/c9moser/sgbackup.git
synced 2026-01-19 19:40:13 +00:00
fixed backups
This commit is contained in:
parent
f42c1358f6
commit
4aa56401e8
@ -20,4 +20,6 @@ _GTK_IMPORTED_ = False
|
||||
|
||||
if not _GTK_IMPORTED_:
|
||||
import gi; gi.require_version("Gtk","4.0")
|
||||
from gi.repository import GLib
|
||||
GLib.threads_init()
|
||||
_GTK_IMPORTED_ = True
|
||||
|
||||
@ -43,7 +43,6 @@ class ZipfileArchiver(Archiver):
|
||||
for path,arcname in files.items():
|
||||
cnt+=1
|
||||
self._backup_progress(game,_calc_fraction(div,cnt),"{} -> {}".format(game.name,arcname))
|
||||
print("writing file:",path)
|
||||
zf.write(path,arcname)
|
||||
|
||||
self._backup_progress(game,1.0,"{game} ... FINISHED".format(game=game.name))
|
||||
|
||||
@ -224,14 +224,15 @@ class GameFileMatcher(GObject):
|
||||
raise TypeError("match_type is not a GameFileType instance!")
|
||||
self.__match_type = match_type
|
||||
|
||||
@Property(type=str)
|
||||
@Property
|
||||
def match_file(self)->str:
|
||||
"""
|
||||
match_file The matcher value.
|
||||
|
||||
:type: str
|
||||
"""
|
||||
return self.__match_file
|
||||
return str(self.__match_file)
|
||||
|
||||
@match_file.setter
|
||||
def match_file(self,file:str):
|
||||
self.__match_file = file
|
||||
@ -247,22 +248,14 @@ class GameFileMatcher(GObject):
|
||||
:returns: True if file matches
|
||||
"""
|
||||
def match_glob(filename)->bool:
|
||||
return fnmatch.fnmatch(filename,self.match_file)
|
||||
return fnmatch.fnmatch(filename,self.__match_file)
|
||||
# match_glob()
|
||||
|
||||
def match_filename(filename):
|
||||
if (PLATFORM_WIN32):
|
||||
fn = filename.replace("/","\\")
|
||||
if (self.match_file.endswith("\\")):
|
||||
if fn == self.match_file[:-1] or fn.startswith(self.match_file):
|
||||
return True
|
||||
elif fn == self.match_file:
|
||||
return True
|
||||
else:
|
||||
if (self.match_file.endswith('/')):
|
||||
if fn == self.match_file[:-1] or fn.startswith(self.match_file):
|
||||
if filename == self.match_file[:-1] or filename.startswith(self.match_file):
|
||||
return True
|
||||
elif fn == self.match_file:
|
||||
elif filename == self.match_file:
|
||||
return True
|
||||
return False
|
||||
# match_filename()
|
||||
@ -369,6 +362,7 @@ class GameData(GObject):
|
||||
:type: list[GameFileMatcher]
|
||||
"""
|
||||
return self.__ignorematchers
|
||||
|
||||
@ignore_matchers.setter
|
||||
def ignore_matchers(self,im:list[GameFileMatcher]|None):
|
||||
self.__ignorematchers = []
|
||||
|
||||
@ -986,8 +986,8 @@ class GameDialog(Gtk.Dialog):
|
||||
wg.savegame_root = data['sgroot']
|
||||
wg.savegame_dir = data['sgdir']
|
||||
wg.variables = data['variables']
|
||||
wg.file_match = data["filematch"]
|
||||
wg.ignore_match = data['ignorematch']
|
||||
wg.file_matchers = data["filematch"]
|
||||
wg.ignore_matchers = data['ignorematch']
|
||||
wg.installdir = installdir
|
||||
wg.game_registry_keys = grk
|
||||
wg.installdir_registry_keys = irk
|
||||
@ -1011,8 +1011,8 @@ class GameDialog(Gtk.Dialog):
|
||||
lg.savegame_root = data['sgroot']
|
||||
lg.savegame_dir = data['sgdir']
|
||||
lg.variables = data['variables']
|
||||
lg.file_match = data["filematch"]
|
||||
lg.ignore_match = data['ignorematch']
|
||||
lg.file_matchers = data["filematch"]
|
||||
lg.ignore_matchers = data['ignorematch']
|
||||
lg.binary = binary
|
||||
else:
|
||||
self.__game.linux = LinuxGame(data["sgroot"],
|
||||
@ -1032,8 +1032,8 @@ class GameDialog(Gtk.Dialog):
|
||||
mg.savegame_root = data['sgroot']
|
||||
mg.savegame_dir = data['sgdir']
|
||||
mg.variables = data['variables']
|
||||
mg.file_match = data["filematch"]
|
||||
mg.ignore_match = data['ignorematch']
|
||||
mg.file_matchers = data["filematch"]
|
||||
mg.ignore_matchers = data['ignorematch']
|
||||
mg.binary = binary
|
||||
else:
|
||||
self.__game.macos = MacOSGame(data["sgroot"],
|
||||
@ -1052,8 +1052,8 @@ class GameDialog(Gtk.Dialog):
|
||||
sg.savegame_root = data['sgroot']
|
||||
sg.savegame_dir = data['sgdir']
|
||||
sg.variables = data['variables']
|
||||
sg.file_match = data["filematch"]
|
||||
sg.ignore_match = data['ignorematch']
|
||||
sg.file_matchers = data["filematch"]
|
||||
sg.ignore_matchers = data['ignorematch']
|
||||
sg.appid = data['appid']
|
||||
sg.installdir = data['installdir']
|
||||
else:
|
||||
@ -1074,8 +1074,8 @@ class GameDialog(Gtk.Dialog):
|
||||
sg.savegame_root = data['sgroot']
|
||||
sg.savegame_dir = data['sgdir']
|
||||
sg.variables = data['variables']
|
||||
sg.file_match = data["filematch"]
|
||||
sg.ignore_match = data['ignorematch']
|
||||
sg.file_matchers = data["filematch"]
|
||||
sg.ignore_matchers = data['ignorematch']
|
||||
sg.appid = data['appid']
|
||||
sg.installdir = data['installdir']
|
||||
else:
|
||||
@ -1096,8 +1096,8 @@ class GameDialog(Gtk.Dialog):
|
||||
sg.savegame_root = data['sgroot']
|
||||
sg.savegame_dir = data['sgdir']
|
||||
sg.variables = data['variables']
|
||||
sg.file_match = data["filematch"]
|
||||
sg.ignore_match = data['ignorematch']
|
||||
sg.file_matchers = data["filematch"]
|
||||
sg.ignore_matchers = data['ignorematch']
|
||||
sg.appid = data['appid']
|
||||
sg.installdir = data['installdir']
|
||||
else:
|
||||
@ -1233,11 +1233,9 @@ class GameDialog(Gtk.Dialog):
|
||||
if (data.match_file):
|
||||
label.set_text(data.match_file)
|
||||
label.bind_property('text',data,'match_file',BindingFlags.DEFAULT)
|
||||
#label.connect('changed',self._on_filematch_value_label_changed,widget)
|
||||
label.connect('notify::editing',self._on_filematch_value_notify_editing,widget)
|
||||
else:
|
||||
label.bind_property('text',data,'match_file',BindingFlags.DEFAULT)
|
||||
#label.connect('changed',self._on_filematch_value_label_changed,widget)
|
||||
label.connect('notify::editing',self._on_filematch_value_notify_editing,widget)
|
||||
label.grab_focus()
|
||||
label.start_editing()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user