forked from FotoCoder/Backuppy
deleted backupp.py
deleted backup.py because we don't need it anymore.
This commit is contained in:
parent
00fa691116
commit
e3bccb0715
1 changed files with 0 additions and 268 deletions
268
backup.py
268
backup.py
|
@ -1,268 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
project: Backuppy
|
||||
version: 1.01.001
|
||||
file: backup.py
|
||||
summary: main entry python file
|
||||
"""
|
||||
|
||||
# Standard library imports
|
||||
import os
|
||||
|
||||
# Third party imports
|
||||
from PySide2 import QtCore
|
||||
from PySide2 import QtGui
|
||||
from PySide2 import QtCore, QtWidgets
|
||||
|
||||
# local imports
|
||||
from languages import english
|
||||
from languages import german
|
||||
|
||||
# local globals
|
||||
VERSION: str = "1.01.001"
|
||||
EMAIL: str = "fotocoder@joschu.ch"
|
||||
LANG_EN: str = "English"
|
||||
LANG_DE: str = "German"
|
||||
LANGUAGE: str = LANG_EN
|
||||
MYDIR: str = os.getcwd()
|
||||
SOURCEDIR: str = None
|
||||
EXCLUDE: bool = True
|
||||
TARGETDIR: str = None
|
||||
|
||||
def get_lang_text(search_str: str):
|
||||
return_str: str = eval("english." + search_str)
|
||||
global LANGUAGE
|
||||
if LANGUAGE == LANG_DE:
|
||||
return_str = eval("german." + search_str)
|
||||
return return_str
|
||||
|
||||
|
||||
class BackuppyWizard(QtWidgets.QWizard):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.addPage(Page01(self))
|
||||
self.addPage(Page02(self))
|
||||
self.addPage(Page03(self))
|
||||
self.addPage(Page04(self))
|
||||
self.addPage(Page05(self))
|
||||
self.addPage(Page06(self))
|
||||
self.addPage(Page07(self))
|
||||
self.addPage(Page08(self))
|
||||
self.addPage(Page09(self))
|
||||
self.addPage(Page10(self))
|
||||
|
||||
self.setWindowTitle(english.intromsg1)
|
||||
self.resize(640, 480)
|
||||
|
||||
class Page01(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label = QtWidgets.QLabel("Hello, first of all, which language do you prefer: English or German?")
|
||||
# self.comboBox = QIComboBox(self)
|
||||
self.comboBox = QtWidgets.QComboBox(self)
|
||||
self.comboBox.addItem("English", LANG_DE)
|
||||
self.comboBox.addItem("German", LANG_EN)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label)
|
||||
layout.addWidget(self.comboBox)
|
||||
self.setLayout(layout)
|
||||
|
||||
def validatePage(self):
|
||||
global LANGUAGE
|
||||
if self.comboBox.currentText() == LANG_DE:
|
||||
LANGUAGE = LANG_DE
|
||||
else:
|
||||
LANGUAGE = LANG_EN
|
||||
return True
|
||||
|
||||
|
||||
class Page02(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.label2 = QtWidgets.QLabel()
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.label2)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("languagepack"))
|
||||
self.label2.setText(get_lang_text("intromsg2"))
|
||||
|
||||
|
||||
class Page03(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label = QtWidgets.QLabel()
|
||||
self.groupbox = QtWidgets.QGroupBox()
|
||||
self.groupbox.setFlat(True)
|
||||
self.radio1 = QtWidgets.QRadioButton()
|
||||
self.radio2 = QtWidgets.QRadioButton()
|
||||
|
||||
vbox = QtWidgets.QVBoxLayout()
|
||||
vbox.addWidget(self.radio1)
|
||||
vbox.addWidget(self.radio2)
|
||||
vbox.addStretch(1)
|
||||
self.groupbox.setLayout(vbox)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label)
|
||||
layout.addWidget(self.groupbox)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label.setText(get_lang_text("excludefile1"))
|
||||
self.radio1.setText(get_lang_text("Yes"))
|
||||
self.radio2.setText(get_lang_text("No"))
|
||||
self.radio1.setChecked(True)
|
||||
|
||||
def validatePage(self):
|
||||
global EXCLUDE
|
||||
if self.radio1.isChecked():
|
||||
EXCLUDE = True
|
||||
else:
|
||||
EXCLUDE = False
|
||||
return True
|
||||
|
||||
class Page04(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label = QtWidgets.QLabel()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
global EXCLUDE
|
||||
if EXCLUDE:
|
||||
self.label.setText(get_lang_text("excludefile2"))
|
||||
else:
|
||||
self.label.setText(get_lang_text("excludefile3"))
|
||||
|
||||
class Page05(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.label2 = QtWidgets.QLabel()
|
||||
self.edit = QtWidgets.QLineEdit()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.label2)
|
||||
layout.addWidget(self.edit)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("srcdir1"))
|
||||
self.label2.setText(get_lang_text("srcdir2"))
|
||||
|
||||
def validatePage(self):
|
||||
global SOURCEDIR
|
||||
SOURCEDIR = self.edit.text()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class Page06(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.label2 = QtWidgets.QLabel()
|
||||
self.label3 = QtWidgets.QLabel()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.label2)
|
||||
layout.addWidget(self.label3)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("srcdir3_1"))
|
||||
self.label2.setText(SOURCEDIR)
|
||||
self.label3.setText(get_lang_text("srcdir3_2"))
|
||||
|
||||
|
||||
class Page07(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.edit = QtWidgets.QLineEdit()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.edit)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("targetdir1"))
|
||||
|
||||
def validatePage(self):
|
||||
global TARGETDIR
|
||||
TARGETDIR = self.edit.text()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class Page08(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.label2 = QtWidgets.QLabel()
|
||||
self.label3 = QtWidgets.QLabel()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.label2)
|
||||
layout.addWidget(self.label3)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("targetdir2_1"))
|
||||
self.label2.setText(TARGETDIR)
|
||||
self.label3.setText(get_lang_text("targetdir2_2"))
|
||||
|
||||
|
||||
class Page09(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.label2 = QtWidgets.QLabel()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.label2)
|
||||
self.setLayout(layout)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("collect"))
|
||||
global SOURCEDIR, TARGETDIR
|
||||
self.label2.setText(f"rsync -aqp --exclude-from={MYDIR}/exclude.txt {SOURCEDIR} {TARGETDIR}")
|
||||
|
||||
|
||||
class Page10(QtWidgets.QWizardPage):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.label1 = QtWidgets.QLabel()
|
||||
self.label2 = QtWidgets.QLabel()
|
||||
self.label3 = QtWidgets.QLabel()
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(self.label1)
|
||||
layout.addWidget(self.label2)
|
||||
layout.addWidget(self.label3)
|
||||
self.setLayout(layout)
|
||||
self.setFinalPage(True)
|
||||
|
||||
def initializePage(self):
|
||||
self.label1.setText(get_lang_text("outro1"))
|
||||
self.label2.setText(get_lang_text("outro2"))
|
||||
urlLink = f"<a href='mailto: {EMAIL}'>{EMAIL}</a>"
|
||||
self.label3.setText(urlLink)
|
||||
self.label3.setOpenExternalLinks(True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(f"Starting backup.py v{VERSION}")
|
||||
app = QtWidgets.QApplication()
|
||||
wizard = BackuppyWizard()
|
||||
wizard.show()
|
||||
app.exec_()
|
||||
print("Ending backup.py")
|
Loading…
Reference in a new issue