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