-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt a minimal working GUI via PyQt5
- Loading branch information
1 parent
5a407ed
commit 7e1cf23
Showing
11 changed files
with
613 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ pyyaml | |
tqdm | ||
colorama | ||
pyinstaller | ||
pyqt5 | ||
pyqtgraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# System modules | ||
import pathlib | ||
import functools | ||
from PyQt5.QtWidgets import( | ||
QLabel, | ||
QPushButton, | ||
QSpinBox, | ||
QFileDialog, | ||
QSizePolicy | ||
) | ||
|
||
from PyQt5.QtCore import Qt | ||
import pyqtgraph as pg | ||
|
||
#------------------------------------------------------------------------------# | ||
|
||
def pyqtgraph_setup(): | ||
|
||
pg.setConfigOptions(background='w') | ||
pg.setConfigOptions(foreground='k') | ||
pg.setConfigOptions(antialias=True) | ||
|
||
#------------------------------------------------------------------------------# | ||
|
||
class Label(QLabel): | ||
|
||
# QLabel w/ desired default settings | ||
|
||
def __init__(self, text): | ||
|
||
super().__init__(text) | ||
|
||
# Center text | ||
self.setAlignment(Qt.AlignCenter) | ||
|
||
class PushButton(QPushButton): | ||
|
||
# QPushButton w/ desired default settings | ||
|
||
def __init__(self, text): | ||
|
||
super().__init__(text) | ||
|
||
# Automatic rescaling in both dimensions | ||
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) | ||
|
||
class SpinBox(QSpinBox): | ||
|
||
# QSpinBox w/ desired default settings | ||
|
||
def __init__(self, min, max): | ||
|
||
super().__init__() | ||
|
||
self.setMinimum(min) | ||
self.setMaximum(max) | ||
|
||
spinBoxMax = 2147483647 # Enforced by QSpinBox.setMaximum | ||
|
||
#------------------------------------------------------------------------------# | ||
|
||
def action_get_file(parent, target): | ||
return functools.partial(get_file, parent, target) | ||
|
||
def get_file(parent, target): | ||
|
||
fileName = QFileDialog.getOpenFileName(parent, "Select Input File", pathlib.Path(".").resolve().as_posix(), "Input Files (*.yml *.yaml)") | ||
target.setText(fileName[0]) | ||
|
||
#------------------------------------------------------------------------------# | ||
|
||
def action_get_directory(parent, target): | ||
return functools.partial(get_directory, parent, target) | ||
|
||
def get_directory(parent, target): | ||
|
||
directory = QFileDialog.getExistingDirectory(parent, "Select Output Directory", pathlib.Path(".").resolve().as_posix()) | ||
target.setText(directory) | ||
|
||
#------------------------------------------------------------------------------# | ||
|
||
if __name__ == "__main__": | ||
pass |
Oops, something went wrong.