Skip to content

Commit

Permalink
Merge pull request #6 from HallLab/5-remove-fbs
Browse files Browse the repository at this point in the history
5 remove fbs
  • Loading branch information
jrm5100 committed Jun 11, 2020
2 parents 3c96b3a + 69e9dea commit 283546d
Show file tree
Hide file tree
Showing 90 changed files with 1,465 additions and 198 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ venv/
ENV/
env.bak/
venv.bak/
Pipfile.lock

# Spyder project settings
.spyderproject
Expand Down
15 changes: 15 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
flake8 = "*"

[packages]
clarite = "==1.0.0"
pyqt5 = "==5.15.0"
pypiwin32 = {version = "*", sys_platform = "== 'win32'"}

[requires]
python_version = ">=3.6"
51 changes: 10 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,28 @@ A GUI Version of CLARITE

![alt text][logo]

[logo]: src/main/resources/base/images/clarite_logo.png "CLARITE Logo"
[logo]: gui/resources/images/clarite_logo.png "CLARITE Logo"

Full documentation on [ReadTheDocs.io](https://clarite-gui.readthedocs.io/en/stable/)

## Install

Requires Python v3.6

1. Download the repository and navigate to the main folder
2. Create a python venv

python -m venv venv

3. Activate the environment

On Mac/Linux:

source venv/bin/activate

On Windows:

call venv\scripts\activate.bat

4. Install the requirements

On Mac/Linux:

source src\requirements\base.txt

On Windows:

pip install -r src\requirements\windows.txt

*NOTE*: Update resources with `pyrcc -o gui/resources/app_resources.py gui/resources/app_resources.qrc`

## Running

1. Activate the environment (if not already activated)

On Mac/Linux:

source venv/bin/activate
1. Download or clone this repository and enter the folder
2. Ensure pipenv is installed

On Windows:
``pip install pipenv``

call venv\scripts\activate.bat
3. Create/update the pipenv

2. Run
``pipenv update``

fbs run
4. Run:

## Creating an executable (currently not working)
``pipenv run python main.py``

python -m fbs freeze
Executables will be provided for future releases.

## Citing CLARITE

Expand Down
20 changes: 10 additions & 10 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ Installation
============

1. Download or clone this repository and enter the folder
2. Install Requirements
2. Ensure pipenv is installed

* Windows:
``python -m pip install -r src/requirements/windows.txt``
* Mac:
``python -m pip install -r src/requirements/mac.txt``
* Linux:
``python -m pip install -r src/requirements/base.txt``
``pip install pipenv``

3. Run:
``python src\main\python\clarite_gui\main.py``
3. Create/update the pipenv

Installers will be provided for future releases.
``pipenv update``

4. Run:

``pipenv run python main.py``

Executables will be provided for future releases.
1 change: 1 addition & 0 deletions gui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .app_context import AppContext
27 changes: 10 additions & 17 deletions src/main/python/clarite_gui/main.py → gui/app_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import pandas as pd
from PyQt5.QtCore import pyqtSignal, QObject
from fbs_runtime.application_context.PyQt5 import ApplicationContext, cached_property
from PyQt5.QtWidgets import QApplication

from main_window import MainWindow
from models import Dataset
from .main_window import MainWindow
from .models import Dataset


class AppContext(ApplicationContext):
class AppContext:
"""
The application context holds the current data and is passed to all widgets in the app.
The data in the application context should only be modified via its methods.
Expand All @@ -20,9 +20,6 @@ class AppContext(ApplicationContext):
APPLICATION = "Clarite"

def __init__(self, *args, **kwargs):
super(AppContext, self).__init__(*args, **kwargs)
self.signals = AppctxSignals()

# Main display widgets that expose functions to update themselves (set to None initially)
self.dataset_widget = None
self.command_dock_widget = None
Expand All @@ -32,6 +29,12 @@ def __init__(self, *args, **kwargs):
self.datasets: List[Dataset] = []
self.current_dataset_idx: Optional[int] = None

self.signals = AppctxSignals()
self.app = QApplication(sys.argv)
self.main_window = MainWindow(self)

self.app.setApplicationName("CLARITE")

def run(self):
"""
Run the application
Expand All @@ -47,10 +50,6 @@ def run(self):
# self.add_dataset(Dataset("replication_results", "ewas_result", repl_result))

return self.app.exec_()

@cached_property
def main_window(self):
return MainWindow(self)

# Slots that update data in the app context

Expand Down Expand Up @@ -120,9 +119,3 @@ class AppctxSignals(QObject):
changed_dataset = pyqtSignal(int) # Idx of dataset that was changed to
log_info = pyqtSignal(str)
log_python = pyqtSignal(str)


if __name__ == '__main__':
appctxt = AppContext()
exit_code = appctxt.run()
sys.exit(exit_code)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QFormLayout, QPushButton, QHBoxLayout

from gui.resources import app_resources


class AboutDialog(QDialog):
"""
Expand Down Expand Up @@ -41,15 +43,15 @@ def setup_ui(self):
# Hall Lab Logo Button
self.button = QPushButton('', self)
self.button.clicked.connect(lambda: self.open_site("https://www.hall-lab.org"))
self.button.setIcon(QIcon(self.appctx.get_resource('images/hall_lab_logo.png')))
self.button.setIcon(QIcon(':/images/hall_lab_logo.png'))
self.button.setIconSize(QSize(60, 60))
self.button.setFixedSize(64, 64)
bottom_layout.addWidget(self.button)

# Clarite Logo Button
self.button = QPushButton('', self)
self.button.clicked.connect(lambda: self.open_site("https://www.hall-lab.org/clarite-python/"))
self.button.setIcon(QIcon(self.appctx.get_resource('images/clarite_logo.png')))
self.button.setIcon(QIcon(':/images/clarite_logo.png'))
self.button.setIconSize(QSize(60, 60))
self.button.setFixedSize(64, 64)
bottom_layout.addWidget(self.button)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDockWidget, QTabWidget

from widgets.commands import LoadButtons, ModifyButtons, DescribeButtons, PlotButtons, AnalyzeButtons
from gui.widgets.commands import LoadButtons, ModifyButtons, DescribeButtons, PlotButtons, AnalyzeButtons


class CommandDockWidget(QDockWidget):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
from pathlib import Path

from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QSize
from PyQt5.QtGui import QFont, QColor, QImage, QPixmap
from PyQt5.QtGui import QColor, QPixmap
from PyQt5.QtWidgets import QGroupBox, QHBoxLayout, QVBoxLayout, QComboBox, QLabel, QPushButton, QFileDialog

from main_window.main_window_widgets.dataset_table_view import DatasetTableView
from models import PandasDFModel
from widgets.utilities import RunProgress, confirm_click
from gui.main_window.main_window_widgets.dataset_table_view import DatasetTableView
from gui.models import PandasDFModel
from gui.widgets.utilities import RunProgress, confirm_click
from gui.resources import app_resources


class DatasetWidget(QGroupBox):
Expand Down Expand Up @@ -54,7 +55,7 @@ def setup_ui(self):

# Placeholder image
self.data_placeholder_image = QLabel(parent=self)
pixmap = QPixmap(self.appctx.get_resource('images/clarite_logo.png'))
pixmap = QPixmap(":/images/clarite_logo.png")
self.data_placeholder_image.setPixmap(pixmap)
self.data_placeholder_image.setAlignment(Qt.AlignCenter)
layout.addWidget(self.data_placeholder_image)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PyQt5.QtGui import QTextCursor
from PyQt5.QtWidgets import QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QFileDialog, QWidget

from widgets.utilities import RunProgress
from gui.widgets.utilities import RunProgress


class LogWidget(QWidget):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from PyQt5.QtGui import QFont, QColor
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QTabWidget, QWidget, QGroupBox, QFormLayout, QLabel, \
QSpinBox, QHBoxLayout, QPushButton
from widgets.utilities import ColorPickerWidget, FontPickerWidget
from gui.widgets.utilities import ColorPickerWidget, FontPickerWidget


class PreferencesDialog(QDialog):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import clarite
import pandas as pd
import numpy as np
from PyQt5 import QtCore
from PyQt5.QtCore import pyqtSlot, QSettings
from PyQt5.QtGui import QFont, QColor
from PyQt5.QtWidgets import QDialog, QFormLayout, QLineEdit, QDialogButtonBox

from widgets.utilities import show_warning
from gui.widgets.utilities import show_warning


class PandasDFModel(QtCore.QAbstractTableModel):
Expand Down Expand Up @@ -156,7 +156,7 @@ def data(self, index, role=QtCore.Qt.DisplayRole):
row_idx = index.row()
col_idx = index.column()
value = self.dataset.df.iloc[row_idx, col_idx]
if type(value) is pd.np.float64:
if type(value) is np.float64:
return f"{value:.{self.data_float_precision}E}"
else:
return str(value)
Expand Down
Empty file added gui/resources/__init__.py
Empty file.

0 comments on commit 283546d

Please sign in to comment.