Skip to content

Commit

Permalink
Merge branch 'hotfix/v2.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
tayden committed Dec 15, 2020
2 parents db3fec3 + 1fe5984 commit 8cb19e5
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 82 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/gui_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ jobs:
run: |
pyinstaller --name=GlintMaskGenerator-${{ steps.tag.outputs.tag }} \
--onefile \
--hidden-import="gui.widgets.buffer_ctrl" \
--hidden-import="gui.widgets.threshold_ctrl" \
--hidden-import="gui.widgets.directory_path" \
--add-data="gui/resources/*.ui:." \
gui/main.py
--hidden-import="widgets.buffer_ctrl" \
--hidden-import="widgets.threshold_ctrl" \
--hidden-import="widgets.directory_path" \
--add-data="widgets/*.ui:." \
--add-data="*.ui:." \
gui.py
- name: Building CLI
run: |
pyinstaller --name=glint-mask-${{ steps.tag.outputs.tag }} -F cli.py
Expand Down Expand Up @@ -69,7 +70,7 @@ jobs:
pip install -r requirements.txt
- name: Building GUI
run: |
pyinstaller --name=GlintMaskGenerator-${{ steps.tag.outputs.tag }} --onefile --windowed --icon="gui/resources/gmt.ico" --hidden-import="gui.widgets.buffer_ctrl" --hidden-import="gui.widgets.threshold_ctrl" --hidden-import="gui.widgets.directory_path" --add-data="gui/resources/*.ui;." gui/main.py
pyinstaller --name=GlintMaskGenerator-${{ steps.tag.outputs.tag }} --onefile --windowed --icon="resources\gmt.ico" --hidden-import="widgets.buffer_ctrl" --hidden-import="widgets.threshold_ctrl" --hidden-import="widgets.directory_path" --add-data="widgets\*.ui;." --add-data="*.ui;." gui.py
- name: Building CLI
run: |
pyinstaller --name=glint-mask-${{ steps.tag.outputs.tag }} -F cli.py
Expand Down
36 changes: 29 additions & 7 deletions gui/main.py → gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,41 @@
Date: 2020-09-16
Description:
"""

import sys
from os import path
from typing import List, Sequence

from PyQt5 import QtWidgets, uic
from loguru import logger

from core.maskers import Masker, MicasenseRedEdgeThresholdMasker, P4MSThresholdMasker, RGBThresholdMasker
from gui.constants import *
from gui.utils import resource_path

# String constants reduce occurrence of silent errors due to typos when doing comparisons
BLUE = "BLUE"
GREEN = "GREEN"
RED = "RED"
REDEDGE = "REDEDGE"
NIR = "NIR"

METHOD_THRESHOLD = "METHOD_THRESHOLD"
METHOD_RATIO = "METHOD_RATIO"

IMG_TYPE_RGB = "IMG_TYPE_RGB"
IMG_TYPE_ACO = "IMG_TYPE_ACO"
IMG_TYPE_P4MS = "IMG_TYPE_P4MS"
IMG_TYPE_MICASENSE_REDEDGE = "IMG_TYPE_MICASENSE_REDEDGE"

# Default slider values in GUI
DEFAULT_BLUE_THRESH = 0.875
DEFAULT_GREEN_THRESH = 1.000
DEFAULT_RED_THRESH = 1.000
DEFAULT_REDEDGE_THRESH = 1.000
DEFAULT_NIR_THRESH = 1.000
DEFAULT_PIXEL_BUFFER = 0
DEFAULT_MAX_WORKERS = 0

bundle_dir = getattr(sys, '_MEIPASS', path.abspath(path.dirname(__file__)))
UI_PATH = path.abspath(path.join(bundle_dir, 'gui.ui'))


class MessageBox(QtWidgets.QMessageBox):
Expand All @@ -40,8 +65,7 @@ def __init__(self, parent):
class GlintMaskGenerator(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()

uic.loadUi(resource_path('gui.ui'), self)
uic.loadUi(UI_PATH, self)
self.show()

# Set default values
Expand Down Expand Up @@ -202,5 +226,3 @@ def run_btn_clicked(self) -> None:
app = QtWidgets.QApplication(sys.argv)
main_window = GlintMaskGenerator()
app.exec_()

# /media/taylor/Samsung_T5/Datasets/ExampleImages/P4MS
6 changes: 3 additions & 3 deletions gui/resources/gui.ui → gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,19 @@
<customwidget>
<class>ThresholdCtrl</class>
<extends>QWidget</extends>
<header>gui/widgets/threshold_ctrl.h</header>
<header>widgets/threshold_ctrl.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DirectoryPath</class>
<extends>QWidget</extends>
<header>gui/widgets/directory_path.h</header>
<header>widgets/directory_path.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BufferCtrl</class>
<extends>QWidget</extends>
<header>gui/widgets/buffer_ctrl.h</header>
<header>widgets/buffer_ctrl.h</header>
<container>1</container>
</customwidget>
</customwidgets>
Expand Down
6 changes: 0 additions & 6 deletions gui/__init__.py

This file was deleted.

30 changes: 0 additions & 30 deletions gui/constants.py

This file was deleted.

23 changes: 0 additions & 23 deletions gui/utils.py

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fire~=0.3.1
numpy~=1.19.1
numpy==1.19.3
pillow~=7.2.0
scipy~=1.5.2
tqdm~=4.49.0
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 6 additions & 2 deletions gui/widgets/buffer_ctrl.py → widgets/buffer_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
Description:
"""

import sys
from os import path

from PyQt5 import QtWidgets, uic

from gui.utils import resource_path
bundle_dir = getattr(sys, '_MEIPASS', path.abspath(path.dirname(__file__)))
UI_PATH = path.abspath(path.join(bundle_dir, 'buffer_ctrl.ui'))


class BufferCtrl(QtWidgets.QWidget):
def __init__(self, parent):
super().__init__(parent)

uic.loadUi(resource_path('buffer_ctrl.ui'), self)
uic.loadUi(UI_PATH, self)
self.show()

self.slider.valueChanged.connect(lambda value: self.spinbox.setValue(int(value)))
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions gui/widgets/directory_path.py → widgets/directory_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
Date: 2020-09-17
Description:
"""
import os
import sys
from os import path

from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import QFileDialog

from gui.utils import resource_path
bundle_dir = getattr(sys, '_MEIPASS', path.abspath(path.dirname(__file__)))
UI_PATH = path.abspath(path.join(bundle_dir, 'directory_path.ui'))


class DirectoryPath(QtWidgets.QWidget):
def __init__(self, parent):
super().__init__(parent)

uic.loadUi(resource_path('directory_path.ui'), self)
uic.loadUi(UI_PATH, self)
self.show()

@property
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions gui/widgets/threshold_ctrl.py → widgets/threshold_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
Description:
"""

import sys
from os import path

from PyQt5 import QtWidgets, uic

from gui.utils import resource_path
bundle_dir = getattr(sys, '_MEIPASS', path.abspath(path.dirname(__file__)))
UI_PATH = path.abspath(path.join(bundle_dir, 'threshold_ctrl.ui'))


class ThresholdCtrl(QtWidgets.QWidget):
def __init__(self, parent):
super().__init__(parent)

uic.loadUi(resource_path('threshold_ctrl.ui'), self)
uic.loadUi(UI_PATH, self)
self.show()

self.slider.valueChanged.connect(lambda value: self.spinbox.setValue(value / 1000.))
Expand Down
File renamed without changes.

0 comments on commit 8cb19e5

Please sign in to comment.