diff --git a/manifest/__init__.py b/manifest/__init__.py new file mode 100644 index 0000000..e554246 --- /dev/null +++ b/manifest/__init__.py @@ -0,0 +1 @@ +from .manifest import * \ No newline at end of file diff --git a/manifest/icon.ico b/manifest/icon.ico new file mode 100644 index 0000000..caa689c Binary files /dev/null and b/manifest/icon.ico differ diff --git a/manifest/icon.png b/manifest/icon.png new file mode 100644 index 0000000..9171070 Binary files /dev/null and b/manifest/icon.png differ diff --git a/manifest/main.py b/manifest/manifest.py similarity index 100% rename from manifest/main.py rename to manifest/manifest.py diff --git a/manifest/qt.py b/manifest/qt.py new file mode 100644 index 0000000..0c48fc7 --- /dev/null +++ b/manifest/qt.py @@ -0,0 +1,89 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +""" +Created on Nov 29, 2019 +Desc: Webp convertor QT +@author: Mashiro @ https://2heng.xin +""" + +import sys +import time +from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QPushButton, QMessageBox, QDesktopWidget, QGridLayout +from PyQt5.QtCore import QCoreApplication +from PyQt5.QtGui import QIcon +from manifest import main as manifest + +class MainWindow(QMainWindow): + def __init__(self): + super().__init__() + self.initUI() + + def initUI(self): + self.statusBar().showMessage('Ready') + + self.BtnWid = QWidget(self) + self.setCentralWidget(self.BtnWid) + grid = QGridLayout() + self.BtnWid.setLayout(grid) + + names = ['Generate manifest.json', + 'Pull from GitHub', + 'Push to GitHub', + 'Release on GitHub', + 'Push manifest.json to WordPress', + 'About and Turtor'] + + actions = [self.Action_1, + self.Action_0, + self.Action_0, + self.Action_0, + self.Action_0] + + positions = [(i, j) for i in range(6) for j in range(1)] + + for position, name, action in zip(positions, names, actions): + if name == '': + continue + button = QPushButton(name) + button.clicked.connect(action) + grid.addWidget(button, *position) + + # self.resize(500, 500) + self.center() + self.setWindowTitle('Manifest Generator') + self.setWindowIcon(QIcon('icon.png')) + + self.show() + + def Action_0(self): + sender = self.sender() + self.statusBar().showMessage('"' + sender.text() + '" was pressed') + + #Generate manifest.json + def Action_1(self): + # self.statusBar().showMessage('Processing...') + # time.sleep(1) + manifest() + self.statusBar().showMessage('`manifest.json` saved.') + + def center(self): + qr = self.frameGeometry() + cp = QDesktopWidget().availableGeometry().center() + qr.moveCenter(cp) + self.move(qr.topLeft()) + + def closeEvent(self, event): + reply = QMessageBox.question(self, 'Message', + "Are you sure to quit?", QMessageBox.Yes | + QMessageBox.No, QMessageBox.No) + + if reply == QMessageBox.Yes: + event.accept() + else: + event.ignore() + +if __name__ == '__main__': + + app = QApplication(sys.argv) + ex = MainWindow() + sys.exit(app.exec_())