Skip to content

Commit

Permalink
Form rework & option group fix (#13)
Browse files Browse the repository at this point in the history
* adding in DeadlineForm

currently works to add and delete deadlines

* removing edit button for now

this will be added back in the future.

* renamed the form to ConfigForm

will add a new deadline form

* updated calendar form to also use ui file

* Cal-Form now auto adjusts size, has minimum

* moved process deadline to bottom right instead of bottom left

* fixed the issue with resetting options groups settings from default upon deadline creation

* updating readme, changelog and versions

also removed paypal link of original gist creator

* Update zipper.sh

added a space after manifest .json so that the zipper would actually pick it up.

Co-authored-by: Crumpton, Bryan S <[email protected]>
  • Loading branch information
BSCrumpton and Crumpton, Bryan S authored May 2, 2021
1 parent 2c42536 commit ae4be66
Show file tree
Hide file tree
Showing 15 changed files with 638 additions and 94 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*.ankiaddon
ankilog.txt
.idea
ConfigForm/main.pyproject.user
CalForm/main.pyproject.user
93 changes: 93 additions & 0 deletions CalForm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'CalForm\form.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(756, 489)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth())
Dialog.setSizePolicy(sizePolicy)
Dialog.setSizeGripEnabled(True)
Dialog.setModal(True)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName("verticalLayout")
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.label = QtWidgets.QLabel(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.comboBox = QtWidgets.QComboBox(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.comboBox.sizePolicy().hasHeightForWidth())
self.comboBox.setSizePolicy(sizePolicy)
self.comboBox.setObjectName("comboBox")
self.verticalLayout.addWidget(self.comboBox)
self.label_2 = QtWidgets.QLabel(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
self.label_2.setSizePolicy(sizePolicy)
self.label_2.setObjectName("label_2")
self.verticalLayout.addWidget(self.label_2)
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem1)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setObjectName("label_3")
self.verticalLayout_2.addWidget(self.label_3)
self.calendarWidget = QtWidgets.QCalendarWidget(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.calendarWidget.sizePolicy().hasHeightForWidth())
self.calendarWidget.setSizePolicy(sizePolicy)
self.calendarWidget.setFirstDayOfWeek(QtCore.Qt.Sunday)
self.calendarWidget.setGridVisible(True)
self.calendarWidget.setObjectName("calendarWidget")
self.verticalLayout_2.addWidget(self.calendarWidget)
self.horizontalLayout.addLayout(self.verticalLayout_2)
self.pushButton = QtWidgets.QPushButton(Dialog)
self.pushButton.setObjectName("pushButton")
self.horizontalLayout.addWidget(self.pushButton)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)

self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)

def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Add new Deadline"))
self.label.setText(_translate("Dialog", "Select the Deck you want to add a deadline to:"))
self.label_2.setText(_translate("Dialog", "Note: The deadline is when you will see all NEW cards by"))
self.label_3.setText(_translate("Dialog", "Select your deadline date:"))
self.pushButton.setText(_translate("Dialog", "Add Deadline"))
146 changes: 146 additions & 0 deletions CalForm/form.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>756</width>
<height>489</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Add new Deadline</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select the Deck you want to add a deadline to:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Note: The deadline is when you will see all NEW cards by</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Select your deadline date:</string>
</property>
</widget>
</item>
<item>
<widget class="QCalendarWidget" name="calendarWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="firstDayOfWeek">
<enum>Qt::Sunday</enum>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Add Deadline</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
28 changes: 28 additions & 0 deletions CalForm/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This Python file uses the following encoding: utf-8
import sys
import os


from PySide2.QtWidgets import QApplication, QDialog
from PySide2.QtCore import QFile
from PySide2.QtUiTools import QUiLoader


class DeadlineForm(QDialog):
def __init__(self):
super(Deadlineform, self).__init__()
self.load_ui()

def load_ui(self):
loader = QUiLoader()
path = os.path.join(os.path.dirname(__file__), "form.ui")
ui_file = QFile(path)
ui_file.open(QFile.ReadOnly)
loader.load(ui_file, self)
ui_file.close()

if __name__ == "__main__":
app = QApplication([])
widget = DeadlineForm()
widget.show()
sys.exit(app.exec_())
3 changes: 3 additions & 0 deletions CalForm/main.pyproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"files": ["main.py", "form.ui"]
}
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog
Will in general track the major changes made from each release

## V2_3
Submitted May 2, 2021
* moved all UI code into QT-Creator .ui files
* when you create a deadline, all of the options group settings are copied from the original config for the deck getting a deadline
95 changes: 95 additions & 0 deletions ConfigForm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'ConfigForm\form.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(674, 455)
Dialog.setModal(False)
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.fieldList = QtWidgets.QListWidget(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.fieldList.sizePolicy().hasHeightForWidth())
self.fieldList.setSizePolicy(sizePolicy)
self.fieldList.setMinimumSize(QtCore.QSize(50, 60))
self.fieldList.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.fieldList.setObjectName("fieldList")
self.horizontalLayout.addWidget(self.fieldList)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.AddDeadlineButton = QtWidgets.QPushButton(Dialog)
self.AddDeadlineButton.setObjectName("AddDeadlineButton")
self.verticalLayout_3.addWidget(self.AddDeadlineButton)
# self.EditDeadlineButton = QtWidgets.QPushButton(Dialog)
# self.EditDeadlineButton.setObjectName("EditDeadlineButton")
# self.verticalLayout_3.addWidget(self.EditDeadlineButton)
self.DeleteDeadlineButton = QtWidgets.QPushButton(Dialog)
self.DeleteDeadlineButton.setObjectName("DeleteDeadlineButton")
self.verticalLayout_3.addWidget(self.DeleteDeadlineButton)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem)
self.horizontalLayout.addLayout(self.verticalLayout_3)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.OneOrManyLabel = QtWidgets.QLabel(Dialog)
self.OneOrManyLabel.setObjectName("OneOrManyLabel")
self.horizontalLayout_3.addWidget(self.OneOrManyLabel)
self.OneOrManyBox = QtWidgets.QComboBox(Dialog)
self.OneOrManyBox.setObjectName("OneOrManyBox")
self.OneOrManyBox.addItem("")
self.OneOrManyBox.addItem("")
self.horizontalLayout_3.addWidget(self.OneOrManyBox)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setSpacing(2)
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setEnabled(True)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
self.buttonBox.setSizePolicy(sizePolicy)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Help)
self.buttonBox.setCenterButtons(False)
self.buttonBox.setObjectName("buttonBox")
self.horizontalLayout_4.addWidget(self.buttonBox)
self.ProcessDeadlineBox = QtWidgets.QPushButton(Dialog)
self.ProcessDeadlineBox.setObjectName("ProcessDeadlineBox")
self.horizontalLayout_4.addWidget(self.ProcessDeadlineBox)
self.verticalLayout.addLayout(self.horizontalLayout_4)

self.retranslateUi(Dialog)
self.buttonBox.rejected.connect(Dialog.reject)
self.buttonBox.accepted.connect(Dialog.accept)
QtCore.QMetaObject.connectSlotsByName(Dialog)
Dialog.setTabOrder(self.fieldList, self.AddDeadlineButton)
Dialog.setTabOrder(self.AddDeadlineButton, self.DeleteDeadlineButton)

def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "editing_fields"))
self.AddDeadlineButton.setText(_translate("Dialog", "Add Deadline"))
# self.EditDeadlineButton.setText(_translate("Dialog", "Edit Deadline"))
self.DeleteDeadlineButton.setText(_translate("Dialog", "Delete Deadline"))
self.OneOrManyLabel.setText(_translate("Dialog", "Choose Pop-Up Style"))
self.OneOrManyBox.setItemText(0, _translate("Dialog", "Single Summary Pop Up"))
self.OneOrManyBox.setItemText(1, _translate("Dialog", "One Pop Up per Deck"))
self.ProcessDeadlineBox.setText(_translate("Dialog", "Process Deadlines"))
Loading

0 comments on commit ae4be66

Please sign in to comment.