diff --git a/tropical/qt/createcalendar.py b/tropical/qt/createcalendar.py new file mode 100644 index 0000000..df16277 --- /dev/null +++ b/tropical/qt/createcalendar.py @@ -0,0 +1,17 @@ + +from PyQt6.QtWidgets import QDialog, QColorDialog +from PyQt6 import uic + +class CreateCalendar(QDialog): + + def __init__(self,uipath): + super(CreateCalendar,self).__init__() + uic.loadUi(uipath+"/CreateCalendar.ui",self) + self.pickerButton.setText("") + self.pickerButton.clicked.connect(self.pickupColor) + self.pickerButton.setStyleSheet("QPushButton { background-color : blue }") + + def pickupColor(self): + hexValue=QColorDialog.getColor().name() + self.pickerButton.setStyleSheet("QPushButton { background-color : "+hexValue+" }") + print("TODO!") diff --git a/tropical/qt/designer/CreateCalendar.ui b/tropical/qt/designer/CreateCalendar.ui new file mode 100644 index 0000000..273036b --- /dev/null +++ b/tropical/qt/designer/CreateCalendar.ui @@ -0,0 +1,98 @@ +<?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>410</width> + <height>131</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="4" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEdit"/> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Name</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEdit_2"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Description</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QPushButton" name="pickerButton"> + <property name="text"> + <string>ColorPicker</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Color</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>Dialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>Dialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tropical/qt/mainwindow.py b/tropical/qt/mainwindow.py index 48da072..d2a7b8d 100644 --- a/tropical/qt/mainwindow.py +++ b/tropical/qt/mainwindow.py @@ -7,6 +7,7 @@ from PyQt6.QtCore import Qt from .caldrawer import CalDrawer from .eventdrawer import EvtDrawer +from .createcalendar import CreateCalendar # Only needed for access to command line arguments import sys, os @@ -35,6 +36,9 @@ def StartApplication(version,calState): window = MainWindow(path, calState) window.setVersion(version) window.show() # IMPORTANT!!!!! Windows are hidden by default. + + d=CreateCalendar(path) + d.show() # Start the event loop. app.exec() diff --git a/tropical/tropical.py b/tropical/tropical.py index 1adb66b..774cf18 100755 --- a/tropical/tropical.py +++ b/tropical/tropical.py @@ -14,7 +14,6 @@ __VERSION__ = "0.1" if __name__ == '__main__': env=Env() -# calState=CalState() - # QtCalanus.StartApplication(__VERSION__,calState) - #print(db.keyExists("calendars",1)) -#db=CalDB("sqlite.db") + calState=CalState() + QtCalanus.StartApplication(__VERSION__,calState) +