Skip to content

Commit

Permalink
added GUI picture to GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Sep 23, 2020
1 parent 07c0924 commit 179d5d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cellpose/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,14 @@ def run(image=None):
warnings.filterwarnings("ignore")
app = QtGui.QApplication(sys.argv)
icon_path = pathlib.Path.home().joinpath('.cellpose', 'logo.png')
guip_path = pathlib.Path.home().joinpath('.cellpose', 'cellpose_gui.png')
if not icon_path.is_file():
cp_dir = pathlib.Path.home().joinpath('.cellpose')
cp_dir.mkdir(exist_ok=True)
print('downloading logo')
utils.download_url_to_file('http://www.cellpose.org/static/images/cellpose_transparent.png', icon_path, progress=True)
if not guip_path.is_file():
utils.download_url_to_file('https://github.com/MouseLand/cellpose/raw/master/docs/_static/cellpose_gui.png', guip_path, progress=True)
icon_path = str(icon_path.resolve())
app_icon = QtGui.QIcon()
app_icon.addFile(icon_path, QtCore.QSize(16, 16))
Expand Down Expand Up @@ -214,6 +217,10 @@ def help_window(self):
HW = guiparts.HelpWindow(self)
HW.show()

def gui_window(self):
EG = guiparts.ExampleGUI(self)
EG.show()

def make_buttons(self):
label_style = """QLabel{
color: white
Expand Down
18 changes: 18 additions & 0 deletions cellpose/guiparts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pyqtgraph import functions as fn
from pyqtgraph import Point
import numpy as np
import pathlib

def horizontal_slider_style():
return """QSlider::groove:horizontal {
Expand Down Expand Up @@ -62,6 +63,22 @@ def horizontal_slider_style():
border-radius: 4px;
}"""

class ExampleGUI(QtGui.QDialog):
def __init__(self, parent=None):
super(ExampleGUI, self).__init__(parent)
self.setGeometry(100,100,1300,900)
self.setWindowTitle('GUI layout')
self.win = QtGui.QWidget(self)
layout = QtGui.QGridLayout()
self.win.setLayout(layout)
guip_path = pathlib.Path.home().joinpath('.cellpose', 'cellpose_gui.png')
guip_path = str(guip_path.resolve())
pixmap = QtGui.QPixmap(guip_path)
label = QtGui.QLabel(self)
label.setPixmap(pixmap)
pixmap.scaled
layout.addWidget(label, 0, 0, 1, 1)

class HelpWindow(QtGui.QDialog):
def __init__(self, parent=None):
super(HelpWindow, self).__init__(parent)
Expand All @@ -70,6 +87,7 @@ def __init__(self, parent=None):
self.win = QtGui.QWidget(self)
layout = QtGui.QGridLayout()
self.win.setLayout(layout)

text = ('''
<p class="has-line-data" data-line-start="5" data-line-end="6">Main GUI mouse controls:</p>
<ul>
Expand Down
6 changes: 6 additions & 0 deletions cellpose/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ def editmenu(parent):
def helpmenu(parent):
main_menu = parent.menuBar()
help_menu = main_menu.addMenu("&Help")

openHelp = QtGui.QAction("&Help window", parent)
openHelp.setShortcut("Ctrl+H")
openHelp.triggered.connect(parent.help_window)
help_menu.addAction(openHelp)

openGUI = QtGui.QAction("&GUI example image", parent)
openGUI.setShortcut("Ctrl+G")
openGUI.triggered.connect(parent.gui_window)
help_menu.addAction(openGUI)

0 comments on commit 179d5d4

Please sign in to comment.