From 6da5c7b4634c8db141da2156bc5d4a31151084eb Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 11 Sep 2020 17:52:54 +0200 Subject: [PATCH] start on igniter - pype bootstrap --- igniter/__init__.py | 0 igniter/__main__.py | 13 +++ igniter/bootstrap_repos.py | 6 ++ igniter/install_dialog.py | 179 +++++++++++++++++++++++++++++++++++++ igniter/pype_icon.png | Bin 0 -> 1723 bytes setup.cfg | 2 +- setup.py | 14 ++- tests/README.md | 0 version.py | 2 + 9 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 igniter/__init__.py create mode 100644 igniter/__main__.py create mode 100644 igniter/bootstrap_repos.py create mode 100644 igniter/install_dialog.py create mode 100644 igniter/pype_icon.png create mode 100644 tests/README.md diff --git a/igniter/__init__.py b/igniter/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/igniter/__main__.py b/igniter/__main__.py new file mode 100644 index 0000000000..b891ade37e --- /dev/null +++ b/igniter/__main__.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +"""Open install dialog.""" + +import sys +from Qt import QtWidgets + +from .install_dialog import InstallDialog + +print(__file__) +app = QtWidgets.QApplication(sys.argv) +d = InstallDialog() +d.show() +sys.exit(app.exec_()) diff --git a/igniter/bootstrap_repos.py b/igniter/bootstrap_repos.py new file mode 100644 index 0000000000..1c383558ab --- /dev/null +++ b/igniter/bootstrap_repos.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +"""Bootstrap Pype repositories.""" + + +def check_user_repos(): + pass diff --git a/igniter/install_dialog.py b/igniter/install_dialog.py new file mode 100644 index 0000000000..6b46a73e95 --- /dev/null +++ b/igniter/install_dialog.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +"""Show dialog for choosing central pype repository.""" +import sys +import os +from Qt import QtCore, QtGui, QtWidgets + + +class InstallDialog(QtWidgets.QDialog): + _size_w = 400 + _size_h = 300 + _path = None + + def __init__(self, parent=None): + super(InstallDialog, self).__init__(parent) + + self.setWindowTitle("Pype - Configure Pype repository path") + self._icon_path = os.path.join( + os.path.dirname(__file__), 'pype_icon.png') + icon = QtGui.QIcon(self._icon_path) + self.setWindowIcon(icon) + self.setWindowFlags( + QtCore.Qt.WindowCloseButtonHint | + QtCore.Qt.WindowMinimizeButtonHint + ) + + self.setMinimumSize( + QtCore.QSize(self._size_w, self._size_h)) + self.setMaximumSize( + QtCore.QSize(self._size_w + 100, self._size_h + 100)) + + self._init_ui() + + def _init_ui(self): + self.setStyleSheet("background-color: rgb(23, 23, 23);") + main = QtWidgets.QVBoxLayout(self) + + # Main info + # -------------------------------------------------------------------- + self.main_label = QtWidgets.QLabel( + """Welcome to Pype +

+ We've detected Pype is not configured yet. But don't worry, + this is as easy as setting one path. +

+ """) + self.main_label.setWordWrap(True) + self.main_label.setStyleSheet("color: rgb(200, 200, 200);") + + # Pype path info + # -------------------------------------------------------------------- + + self.pype_path_label = QtWidgets.QLabel( + """Set this path to your studio Pype repository to keep in + sync with your studio environment. This can be path or url. + Leave it empty if you want to use Pype version that come with this + installation. + """ + ) + + self.pype_path_label.setWordWrap(True) + self.pype_path_label.setStyleSheet("color: rgb(150, 150, 150);") + + # Path/Url box | Select button + # -------------------------------------------------------------------- + + input_layout = QtWidgets.QHBoxLayout() + + input_layout.setContentsMargins(0, 10, 0, 10) + self.user_input = QtWidgets.QLineEdit() + + self.user_input.setPlaceholderText("Pype repository path or url") + self.user_input.textChanged.connect(self._path_changed) + self.user_input.setStyleSheet( + ("color: rgb(233, 233, 233);" + "background-color: rgb(64, 64, 64);" + "padding: 0.5em;" + "border: 1px solid rgb(32, 32, 32);") + ) + + self.btn_select = QtWidgets.QPushButton("Select") + self.btn_select.setToolTip( + "Select Pype repository" + ) + self.btn_select.setStyleSheet( + ("color: rgb(64, 64, 64);" + "background-color: rgb(72, 200, 150);" + "padding: 0.5em;") + ) + self.btn_select.setMaximumSize(100, 140) + self.btn_select.clicked.connect(self._on_select_clicked) + + input_layout.addWidget(self.user_input) + input_layout.addWidget(self.btn_select) + + # Bottom button bar + # -------------------------------------------------------------------- + + bottom_widget = QtWidgets.QWidget() + bottom_layout = QtWidgets.QHBoxLayout() + pype_logo_label = QtWidgets.QLabel("pype logo") + pype_logo = QtGui.QPixmap(self._icon_path) + # pype_logo.scaled( + # pype_logo_label.width(), + # pype_logo_label.height(), QtCore.Qt.KeepAspectRatio) + pype_logo_label.setPixmap(pype_logo) + pype_logo_label.setContentsMargins(10, 0, 0, 10) + + ok_button = QtWidgets.QPushButton("OK") + ok_button.setStyleSheet( + ("color: rgb(64, 64, 64);" + "background-color: rgb(72, 200, 150);" + "padding: 0.5em;") + ) + ok_button.setMinimumSize(64, 24) + ok_button.setToolTip("Save and continue") + ok_button.clicked.connect(self._on_ok_clicked) + + exit_button = QtWidgets.QPushButton("Exit") + exit_button.setStyleSheet( + ("color: rgb(64, 64, 64);" + "background-color: rgb(128, 128, 128);" + "padding: 0.5em;") + ) + exit_button.setMinimumSize(64, 24) + exit_button.setToolTip("Exit without saving") + exit_button.clicked.connect(self._on_exit_clicked) + + bottom_layout.setContentsMargins(0, 10, 0, 0) + bottom_layout.addWidget(pype_logo_label) + bottom_layout.addStretch(1) + bottom_layout.addWidget(ok_button) + bottom_layout.addWidget(exit_button) + + bottom_widget.setLayout(bottom_layout) + bottom_widget.setStyleSheet("background-color: rgb(32, 32, 32);") + + # Status label + # -------------------------------------------------------------------- + self._status_label = QtWidgets.QLabel() + self._status_label.setContentsMargins(0, 10, 0, 10) + self._status_label.setStyleSheet("color: rgb(72, 200, 150);") + + # add all to main + + main.addWidget(self.main_label) + main.addWidget(self.pype_path_label) + main.addLayout(input_layout) + main.addStretch(1) + main.addWidget(self._status_label) + main.addWidget(bottom_widget) + self.setLayout(main) + + def _on_select_clicked(self): + fname = QtWidgets.QFileDialog.getExistingDirectory( + self, 'Select path') + + if fname: + fname = QtCore.QDir.toNativeSeparators(fname) + + if os.path.isdir(fname): + self.user_input.setText(fname) + + def _on_ok_clicked(self): + if not self._path: + pass + + def _on_exit_clicked(self): + self.close() + + def _path_changed(self, path): + self._path = path + self._status_label.setText(f"selected {path}") + + +if __name__ == "__main__": + app = QtWidgets.QApplication(sys.argv) + d = InstallDialog() + d.show() + sys.exit(app.exec_()) diff --git a/igniter/pype_icon.png b/igniter/pype_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c17d6ee4c1806c78a34d0d15e7a7d47f5be47d59 GIT binary patch literal 1723 zcmbVNZD<>19KS5uWbN9eR-BVguQwPidar3N$+4{IlCF(4ZD<2+$IxBwo+L+eFTJ}q zY1}jsRy&8d2^Kf^At3mI!w++lfy@=GFsv0O>K8xRZB##~6N?l?>vL%mI-L%8@Z9s< z^ZcIQ|NVc*V*|a7^^epe2+|no3lG5=wT80}zKwi-6;4~VzA*zq8d|JjL(ZIi7(woT zNQ#e|qtT~0L6r$!R1<*6$r?l>$lk7;#tY-XL=zw-DFN)~kFH>-BnGe%Pn3#kA&{2( z@;VsK55$H1xZoGDu6^j<90v(xVDe~A&L{?#3t(kl4z8_j5<|-nb3A}`TLRJ1XbcUh zIzU;1!Uc+AP_Lh$+0IUudIDuAh9W5sNi#Uja#SZrd(p~+L20^}E@`HuDyYTCC)7zZfI&?+ zOpvu2tzuN%1RX}^c#Wh9$}*`86ond2o76L9;i5o-43L3h8W2m@uv%I*RU@tb3w7=I zHUZGJ(P&M^9d(iAnh3+}nSy3i9CAmr5ueroIRp%KQWrqa6jXD!WsSy#bikXc9#_>& zHBhmt$|yq<4B9>-DWaM+IyPMZVcrA*%!(RL`Ei<#!>GC4oZI&}#c&k00gbAnl$`!2 z)XPzR&cogYg()NQCVyA3C~!$tmw9NgB=adiYDx-2Yi{I1YDU$eV5psY^L`{0is@=n z%D@9-sCPda=?Ss4pJj1|pv&q;qg+HWOkNQ{Bpkq?a|lTixdh|&B|*}Q1J;|s1#hPZ z_jkhdVg%O1dss1<^m(fH!>TZ8r9kz*_&@It>JltLK6B4JR$*GX!}Uo9jOuiybcVr1 zWtEZ8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