jumps in form ability, about form ui, QGraphicsView clicking functionality, massive package restructuring

This commit is contained in:
Xevion
2019-08-04 04:04:47 -05:00
parent 6223fcfd7b
commit ed60efd485
14 changed files with 27834 additions and 33 deletions

View File

@@ -2,7 +2,7 @@
## The Repository
![trtx: you can radially blur any image and it'll be funny](./resources/screenshot.png)
![trtx: you can radially blur any image and it'll be funny](./package/ui/images/screenshot.png)
The purpose of this project is to simply provide an easy way to apply a blur effect to an image using the ShareX application.
The reasoning for zoom is mostly for personal humor.
@@ -12,7 +12,7 @@ The effect may reach into being just zoom for radially, depending on how far I c
In case you wish to use this repo, these are the utilties you will require.
### [./main.py](./process.py)
**
**os** - Path managemennt
@@ -22,12 +22,6 @@ In case you wish to use this repo, these are the utilties you will require.
**subprocess** - Issuing commands to ImageMagick
### [./clean.py](./clean.py)
**os** - Path Management
**sys** - Path Management
**send2trash** - sending files to recycle bin instead of permanently deleting
## Resources

0
gui.py
View File

View File

@@ -0,0 +1,4 @@
if __name__ == "__main__":
import sys
from package import app
sys.exit(app.run())

46
package/app.py Normal file
View File

@@ -0,0 +1,46 @@
from PyQt5 import QtWidgets, QtCore
from ui.mainwindow import Ui_MainWindow
from ui.aboutform import Ui_AboutForm
import sys
class AboutWindow(QtWidgets.QMainWindow):
def __init__(self):
super(AboutWindow, self).__init__()
self.ui = Ui_AboutForm()
self.ui.setupUi(self)
class Window(QtWidgets.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.ui = Ui_MainWindow()
self.aboutui = AboutWindow()
self.ui.setupUi(self)
self.initUI()
def initUI(self):
self.ui.graphicsView.viewport().installEventFilter(self)
# About tab
self.ui.actionAbout.triggered.connect(lambda : self.aboutui.show())
self.show()
def eventFilter(self, source, e):
if e.type() == QtCore.QEvent.MouseMove:
if e.buttons() == QtCore.Qt.NoButton:
pass
elif e.buttons() == QtCore.Qt.LeftButton:
pass
elif e.buttons() == QtCore.Qt.RightButton:
pass
elif e.type() == QtCore.QEvent.MouseButtonPress:
if e.button() == QtCore.Qt.LeftButton:
print(f'Left Click at ({e.x()}, {e.y()})')
elif e.button() == QtCore.Qt.RightButton:
print(f'Right Click at ({e.x()}, {e.y()})')
return super(Window, self).eventFilter(source, e)
def run():
app = QtWidgets.QApplication([])
window = Window()
sys.exit(app.exec_())
run()

32
package/ui/aboutform.py Normal file
View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources/aboutform.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_AboutForm(object):
def setupUi(self, AboutForm):
AboutForm.setObjectName("AboutForm")
AboutForm.resize(428, 138)
self.label = QtWidgets.QLabel(AboutForm)
self.label.setGeometry(QtCore.QRect(50, 30, 351, 61))
self.label.setObjectName("label")
self.retranslateUi(AboutForm)
QtCore.QMetaObject.connectSlotsByName(AboutForm)
def retranslateUi(self, AboutForm):
_translate = QtCore.QCoreApplication.translate
AboutForm.setWindowTitle(_translate("AboutForm", "About"))
self.label.setText(_translate("AboutForm", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Made by <span style=\" font-weight:600;\">Xevion</span> using PyQt, Qt Designer, ImageMagick and more.</p>\n"
"<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Source on Github | <a href=\"https://github.com/Xevion/sharex-quickzoom\"><span style=\" text-decoration: underline; color:#0000ff;\">https://github.com/Xevion/sharex-quickzoom</span></a></p></body></html>"))
from . import resourcefile_rc

43
package/ui/aboutform.ui Normal file
View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutForm</class>
<widget class="QWidget" name="AboutForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>138</height>
</rect>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<property name="windowIcon">
<iconset resource="resourcefile.qrc">
<normaloff>:/logo/images/sharex.png</normaloff>:/logo/images/sharex.png</iconset>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>351</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Made by &lt;span style=&quot; font-weight:600;&quot;&gt;Xevion&lt;/span&gt; using PyQt, Qt Designer, ImageMagick and more.&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Source on Github | &lt;a href=&quot;https://github.com/Xevion/sharex-quickzoom&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/Xevion/sharex-quickzoom&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<resources>
<include location="resourcefile.qrc"/>
</resources>
<connections/>
</ui>

73
package/ui/mainwindow.py Normal file
View File

@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(539, 540)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/logo/images/sharex.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
MainWindow.setWindowIcon(icon)
MainWindow.setAutoFillBackground(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
self.graphicsView.setGeometry(QtCore.QRect(20, 10, 500, 400))
self.graphicsView.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.CrossCursor))
self.graphicsView.setMouseTracking(True)
self.graphicsView.setObjectName("graphicsView")
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox.setGeometry(QtCore.QRect(140, 440, 141, 17))
self.checkBox.setObjectName("checkBox")
self.checkBox_2 = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox_2.setGeometry(QtCore.QRect(140, 460, 131, 17))
self.checkBox_2.setObjectName("checkBox_2")
self.submitButton = QtWidgets.QPushButton(self.centralwidget)
self.submitButton.setGeometry(QtCore.QRect(280, 420, 241, 61))
self.submitButton.setObjectName("submitButton")
self.spinTypeComboxBox = QtWidgets.QComboBox(self.centralwidget)
self.spinTypeComboxBox.setGeometry(QtCore.QRect(20, 430, 111, 22))
self.spinTypeComboxBox.setObjectName("spinTypeComboxBox")
self.spinTypeComboxBox.addItem("")
self.spinTypeComboxBox.addItem("")
self.thresholdSpinbox = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.thresholdSpinbox.setGeometry(QtCore.QRect(20, 460, 111, 22))
self.thresholdSpinbox.setObjectName("thresholdSpinbox")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 539, 21))
self.menubar.setObjectName("menubar")
self.menuShareX_Quick_ZOom = QtWidgets.QMenu(self.menubar)
self.menuShareX_Quick_ZOom.setObjectName("menuShareX_Quick_ZOom")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionAbout = QtWidgets.QAction(MainWindow)
self.actionAbout.setObjectName("actionAbout")
self.menuShareX_Quick_ZOom.addAction(self.actionAbout)
self.menubar.addAction(self.menuShareX_Quick_ZOom.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "ShareX Quick Zoom"))
self.graphicsView.setToolTip(_translate("MainWindow", "<html><head/><body><p>Click somewhere to center the zoom or radial blur</p></body></html>"))
self.checkBox.setText(_translate("MainWindow", "Overwrite Original File"))
self.checkBox_2.setText(_translate("MainWindow", "Copy to clipboard"))
self.submitButton.setText(_translate("MainWindow", "Save and Exit"))
self.spinTypeComboxBox.setItemText(0, _translate("MainWindow", "Centered Radial / Zoom Blur"))
self.spinTypeComboxBox.setItemText(1, _translate("MainWindow", "Radial Spin Blur"))
self.menuShareX_Quick_ZOom.setTitle(_translate("MainWindow", "ShareX Quick Zoom"))
self.actionAbout.setText(_translate("MainWindow", "About"))
from . import resourcefile_rc

141
package/ui/mainwindow.ui Normal file
View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>539</width>
<height>540</height>
</rect>
</property>
<property name="windowTitle">
<string>ShareX Quick Zoom</string>
</property>
<property name="windowIcon">
<iconset resource="resourcefile.qrc">
<normaloff>:/logo/images/sharex.png</normaloff>:/logo/images/sharex.png</iconset>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QGraphicsView" name="graphicsView">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>500</width>
<height>400</height>
</rect>
</property>
<property name="cursor" stdset="0">
<cursorShape>CrossCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Click somewhere to center the zoom or radial blur&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>140</x>
<y>440</y>
<width>141</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Overwrite Original File</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<property name="geometry">
<rect>
<x>140</x>
<y>460</y>
<width>131</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Copy to clipboard</string>
</property>
</widget>
<widget class="QPushButton" name="submitButton">
<property name="geometry">
<rect>
<x>280</x>
<y>420</y>
<width>241</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>Save and Exit</string>
</property>
</widget>
<widget class="QComboBox" name="spinTypeComboxBox">
<property name="geometry">
<rect>
<x>20</x>
<y>430</y>
<width>111</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>Centered Radial / Zoom Blur</string>
</property>
</item>
<item>
<property name="text">
<string>Radial Spin Blur</string>
</property>
</item>
</widget>
<widget class="QDoubleSpinBox" name="thresholdSpinbox">
<property name="geometry">
<rect>
<x>20</x>
<y>460</y>
<width>111</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>539</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuShareX_Quick_ZOom">
<property name="title">
<string>ShareX Quick Zoom</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuShareX_Quick_ZOom"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
</widget>
<resources>
<include location="resourcefile.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,7 @@
<RCC>
<qresource prefix="logo">
<file>images/Imagemagick.png</file>
<file>images/qt_design.png</file>
<file>images/sharex.png</file>
</qresource>
</RCC>

27484
package/ui/resourcefile_rc.py Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ def run(recycle=True, print_ignores=False):
print_ignores {bool} -- True to print what files have been ignored (default: {False})
"""
# ternary raise support function, shouldn't ever be raised
# ternary raise support function, shouldn't ever be raised normally
def raiseMe(filePath):
raise('Invalid file or folder ; \'{}\''.format(filePath))

View File

@@ -31,4 +31,5 @@ for path in [base_path, blur_map, input_path, output_path]:
# command = ['magick convert', input_path, blur_map, '-compose blur', '-define', 'compose:args=' + command_args, '-composite ', output_path]
command = 'magick convert {} {} -compose blur -define compose:args={} -composite {}'.format(input_path, blur_map, command_args, output_path)
print(command)
breakpoint
subprocess.run(command.split(' '))

View File

@@ -1,24 +0,0 @@
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>MainWindow</string>
</property>
<widget class="QMenuBar" name="menuBar" />
<widget class="QToolBar" name="mainToolBar" />
<widget class="QWidget" name="centralWidget" />
<widget class="QStatusBar" name="statusBar" />
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB