Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Import/Export capabilities #1592

Merged
merged 20 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a496e61
dummy commit
marticliment Nov 27, 2023
e9fb194
remove newline, redundant import
marticliment Nov 27, 2023
4e76cf7
add the new JSON exporting format
marticliment Nov 27, 2023
a40c793
do not export non-installable packages
marticliment Nov 28, 2023
41932be
Packages imported from new PackageList can now be imported
marticliment Nov 28, 2023
f8ee905
add a little bit of documentation
marticliment Nov 28, 2023
61df3fa
split method to create InstallationOptions.fromJson method
marticliment Nov 28, 2023
c6ee61b
add the mechanism to save package options when being imported
marticliment Nov 28, 2023
b3eaa72
improvements in import script
marticliment Nov 28, 2023
69e7abe
prevent crash under special circumstances
marticliment Nov 29, 2023
e4b7a2c
add settings to configure package backuping (logic not implemented yet)
marticliment Nov 29, 2023
696a66d
better naming to folder and setting
marticliment Nov 29, 2023
94b9320
Add backup logic
marticliment Nov 29, 2023
0900f46
better naming
marticliment Nov 29, 2023
5941930
Merge branch 'main' into better-export
marticliment Nov 29, 2023
c4308c0
Add an explanation about the backup, rename setting
marticliment Nov 30, 2023
5dee5fa
Merge branch 'better-export' of https://github.com/marticliment/Winge…
marticliment Nov 30, 2023
fa74bfe
add backup icon
marticliment Nov 30, 2023
f38d2c0
Merge branch 'main' into better-export
marticliment Nov 30, 2023
800c7de
Minor interface improvements to the PackageImportes/Exporter
marticliment Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions wingetui/Interface/CustomWidgets/GenericWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class TreeWidget(QTreeWidget):

def __init__(self, emptystr: str = "") -> None:
super().__init__()
self.header().setDefaultAlignment(Qt.AlignmentFlag.AlignCenter)
self.smoothScrollAnimation = QVariantAnimation(self)
self.smoothScrollAnimation.setDuration(300)
self.smoothScrollAnimation.setEasingCurve(QEasingCurve.OutQuart)
Expand Down
76 changes: 75 additions & 1 deletion wingetui/Interface/CustomWidgets/SectionWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def getChildren(self) -> list:


class SectionHWidget(QWidget):
def __init__(self, lastOne: bool = False, smallerMargins: bool = False):
def __init__(self, lastOne: bool = False, smallerMargins: bool = False, biggerMargins: bool = False):
super().__init__()
if not lastOne:
self.setStyleSheet("#stBtn{border-radius: 0px;border-bottom: 0px}")
Expand All @@ -360,6 +360,8 @@ def __init__(self, lastOne: bool = False, smallerMargins: bool = False):
if smallerMargins:
self.setStyleSheet(self.styleSheet() + "#stBtn{margin: 0px;}")
self.setContentsMargins(0, 0, 0, 0)
elif biggerMargins:
self.setContentsMargins(65, 0, 10, 0)
else:
self.setContentsMargins(40, 0, 0, 0)

Expand Down Expand Up @@ -588,3 +590,75 @@ def stateChangedEvent(self, v: bool):
self.lineedit.setToolTip("")
self.lineedit.setPlaceholderText(self.oldtext)
self.valueChanged.emit(self.lineedit.text())


class SectionCheckBoxDirPicker(SectionCheckBox):
stateChanged = Signal(bool)
valueChanged = Signal(str)
defaultText: str

def __init__(self, text: str, parent=None, helpLabel: str = ""):
super().__init__(text=text, parent=parent)
self.defaultText = _("Select")
self.setAttribute(Qt.WA_StyledBackground)
self.pushButton = QPushButton(self)
self.pushButton.setFixedWidth(450)
self.oldtext = ""
self.pushButton.setObjectName("")
self.pushButton.clicked.connect(self.showDialog)
self.checkbox.stateChanged.connect(self.stateChangedEvent)
self.helplabel = QLabel(helpLabel, self)
self.helplabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
self.helplabel.setOpenExternalLinks(True)
self.stateChangedEvent(self.checkbox.isChecked())
self.checkbox.move((70), 10)
self.checkbox.setFixedHeight(30)
self.setFixedHeight(50)

self.setLayout(QHBoxLayout())
self.layout().addWidget(self.checkbox)
self.layout().addStretch()
self.layout().addWidget(self.helplabel)
self.layout().addWidget(self.pushButton)
self.layout().setContentsMargins(70, 5, 20, 0)

def showDialog(self):
folder = QFileDialog.getExistingDirectory(self, _("Select a folder"), os.path.expanduser("~"))
if folder:
self.valuechangedEvent(folder)
self.setText(folder)

def valuechangedEvent(self, text: str):
self.valueChanged.emit(text)

def setPlaceholderText(self, text: str):
self.pushButton.setText(text)
self.oldtext = text

def setDefaultText(self, text: str):
self.defaultText = text

def setText(self, text: str):
if not self.checkbox.isChecked():
self.pushButton.setText(_("<b>{0}</b> needs to be enabled to change this setting").format(self.checkbox.text()).replace("<b>", "\"").replace("</b>", "\""))
elif text:
self.pushButton.setText(text)
else:
self.pushButton.setText(self.defaultText)

def stateChangedEvent(self, v: bool):
self.pushButton.setEnabled(self.checkbox.isChecked())
if not self.checkbox.isChecked():
self.pushButton.setEnabled(False)
self.oldtext = self.pushButton.text()
self.pushButton.setToolTip(_("<b>{0}</b> needs to be enabled to change this setting").format(self.checkbox.text()))
self.pushButton.setText(_("<b>{0}</b> needs to be enabled to change this setting").format(self.checkbox.text()).replace("<b>", "\"").replace("</b>", "\""))
self.stateChanged.emit(v)
else:
self.stateChanged.emit(v)
self.pushButton.setEnabled(True)
self.pushButton.setToolTip("")
if not self.oldtext:
self.oldtext = self.defaultText
self.pushButton.setText(self.oldtext)
self.valueChanged.emit(self.pushButton.text())