mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-26 14:56:33 +00:00
Initial open support in pytomb/gui
This commit is contained in:
parent
72b44a84f6
commit
9318377aca
@ -47,7 +47,8 @@ class Tomb(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, tombpath, tombsize,keypath, stdout=None, stderr=None, no_color=True, ignore_swap=False):
|
def create(cls, tombpath, tombsize,keypath, stdout=None, stderr=None,
|
||||||
|
no_color=True, ignore_swap=False):
|
||||||
'''If keypath is None, it will be created adjacent to the tomb.
|
'''If keypath is None, it will be created adjacent to the tomb.
|
||||||
This is unsafe, and you should NOT do it.
|
This is unsafe, and you should NOT do it.
|
||||||
|
|
||||||
@ -69,9 +70,20 @@ class Tomb(object):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def open(tombpath,keypath=None):
|
def open(cls, tombpath,keypath=None, no_color=True, ignore_swap=False):
|
||||||
raise NotImplementedError
|
args = [tombpath]
|
||||||
|
if keypath is not None:
|
||||||
|
args += ['-k', keypath]
|
||||||
|
if no_color:
|
||||||
|
args += ['--no-color']
|
||||||
|
if ignore_swap:
|
||||||
|
args += ['--ignore-swap']
|
||||||
|
try:
|
||||||
|
subprocess.check_call([cls.tombexec, 'open'] + args)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -1,10 +1,23 @@
|
|||||||
all: ui_create.py
|
TARGETS_OPEN=tombqt/ui_open_tombfile.py tombqt/ui_open_keymethod.py tombqt/ui_open_success.py
|
||||||
test: ui_create.py
|
TARGETS=tombqt/ui_create.py $(TARGETS_OPEN)
|
||||||
python2 -3 create.py
|
|
||||||
ui_create.py: create.ui
|
all: $(TARGETS)
|
||||||
pyuic4 create.ui -o ui_create.py
|
test_create: tombqt/ui_create.py
|
||||||
|
python2 -3 tombqt/create.py
|
||||||
|
test_open: $(TARGETS_OPEN)
|
||||||
|
python2 -3 tombqt/open.py
|
||||||
|
|
||||||
|
|
||||||
|
tombqt/ui_create.py: tombqt/create.ui
|
||||||
|
pyuic4 create.ui -o tombqt/ui_create.py
|
||||||
|
tombqt/ui_open_tombfile.py: tombqt/open_tombfile.ui
|
||||||
|
pyuic4 tombqt/open_tombfile.ui -o tombqt/ui_open_tombfile.py
|
||||||
|
tombqt/ui_open_keymethod.py: tombqt/open_keymethod.ui
|
||||||
|
pyuic4 tombqt/open_keymethod.ui -o tombqt/ui_open_keymethod.py
|
||||||
|
tombqt/ui_open_success.py: tombqt/open_success.ui
|
||||||
|
pyuic4 tombqt/open_success.ui -o tombqt/ui_open_success.py
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm ui_create.py
|
rm $(TARGETS)
|
||||||
|
|
||||||
.PHONY: test clean
|
.PHONY: test clean
|
||||||
|
@ -73,7 +73,7 @@ class TombCreateWizard(QWizard):
|
|||||||
|
|
||||||
def on_tomb_location_clicked(self, *args, **kwargs):
|
def on_tomb_location_clicked(self, *args, **kwargs):
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self, 'Create Tomb',
|
filename = QtGui.QFileDialog.getSaveFileName(self, 'Create Tomb',
|
||||||
filter="*.tomb")
|
filter="Tomb(*.tomb)")
|
||||||
self.ui.lineEdit_tombpath.setText(filename)
|
self.ui.lineEdit_tombpath.setText(filename)
|
||||||
def on_change_page(self, pagenumber):
|
def on_change_page(self, pagenumber):
|
||||||
if self.currentPage() == self.ui.wizardPage_progress:
|
if self.currentPage() == self.ui.wizardPage_progress:
|
||||||
|
Loading…
Reference in New Issue
Block a user