Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Cinema
Qt-Viewer
Commits
249eb4ad
Commit
249eb4ad
authored
Jan 07, 2016
by
Dave DeMarle
Browse files
Merge branch 'packaging'
parents
43277fe4
d8a044f5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Cinema.py
View file @
249eb4ad
...
...
@@ -44,18 +44,18 @@ import sys
import
json
#open up a store
with
open
(
sys
.
argv
[
1
],
mode
=
"rb"
)
as
file
:
info_json
=
json
.
load
(
file
)
storeType
=
"MFS"
try
:
if
info_json
[
"metadata"
][
"store_type"
]
==
"SFS"
:
cs
=
cinema_store
.
SingleFileStore
(
sys
.
argv
[
1
])
else
:
raise
TypeError
except
(
TypeError
,
KeyError
):
cs
=
cinema_store
.
FileStore
(
sys
.
argv
[
1
])
cs
.
load
()
#
with open(sys.argv[1], mode="rb") as file:
#
info_json = json.load(file)
#
storeType = "MFS"
#
try:
##
if info_json["metadata"]["store_type"] == "SFS":
#
cs = cinema_store.SingleFileStore(sys.argv[1])
#
else:
#
raise TypeError
#
except(TypeError,KeyError):
#
cs = cinema_store.FileStore(sys.argv[1])
cs
=
cinema_store
.
FileStore
()
#
cs.load()
# Show it in Qt
app
=
QApplication
(
sys
.
argv
)
...
...
MainWindow.py
View file @
249eb4ad
...
...
@@ -40,6 +40,7 @@ from PySide.QtGui import QColorDialog
from
cinema_python.compositor
import
*
from
cinema_python.lookup_table
import
*
from
cinema_python.LayerSpec
import
*
from
cinema_python
import
cinema_store
from
QRenderView
import
*
from
RenderViewMouseInteractor
import
*
import
math
...
...
@@ -50,6 +51,7 @@ class MainWindow(QMainWindow):
# Set title
self
.
setWindowTitle
(
'Cinema Desktop'
)
self
.
setGeometry
(
300
,
300
,
900
,
600
)
# Set up UI
self
.
_mainWidget
=
QSplitter
(
Qt
.
Horizontal
,
self
)
...
...
@@ -59,6 +61,7 @@ class MainWindow(QMainWindow):
self
.
_displayWidget
.
setRenderHints
(
QPainter
.
SmoothPixmapTransform
)
self
.
_displayWidget
.
setAlignment
(
Qt
.
AlignCenter
)
self
.
_displayWidget
.
setSizePolicy
(
QSizePolicy
.
Ignored
,
QSizePolicy
.
Ignored
)
self
.
_displayWidget
.
resize
(
600
,
300
)
self
.
_parametersWidget
=
QWidget
(
self
)
self
.
_parametersWidget
.
setMinimumSize
(
QSize
(
200
,
100
))
...
...
@@ -94,6 +97,16 @@ class MainWindow(QMainWindow):
# Set up render view interactor
self
.
_mouseInteractor
=
RenderViewMouseInteractor
()
# File dialog
def
showDialog
(
self
):
fname
,
_
=
QFileDialog
.
getOpenFileName
(
self
,
'Open an info.json File'
,
'~'
,
'JSON Input Files (info.json)'
)
cs
=
cinema_store
.
FileStore
(
fname
)
cs
.
load
()
self
.
setStore
(
cs
)
self
.
show
()
# Create the menu bars
def
createMenus
(
self
):
# File menu
...
...
@@ -102,6 +115,12 @@ class MainWindow(QMainWindow):
self
.
_fileToolBar
=
self
.
menuBar
().
addMenu
(
'&File'
)
self
.
_fileToolBar
.
addAction
(
self
.
_exitAction
)
openFileAction
=
QAction
(
QIcon
(
'open.png'
),
'Open'
,
self
)
openFileAction
.
setShortcut
(
'Ctrl+O'
)
openFileAction
.
setStatusTip
(
'Open an info.json File'
)
openFileAction
.
triggered
.
connect
(
self
.
showDialog
)
self
.
_fileToolBar
.
addAction
(
openFileAction
)
# Set the store currently being displayed
def
setStore
(
self
,
store
):
self
.
_store
=
store
...
...
@@ -122,12 +141,12 @@ class MainWindow(QMainWindow):
# Display the default image
self
.
render
()
# Make the GUI
self
.
_createParameterUI
()
self
.
_create
GeometryColorPicker
()
self
.
_create
ColorMaps
()
self
.
_create
Bg
Color
PickerButton
()
self
.
_parametersWidget
.
layout
().
addStretch
()
if
len
(
self
.
_store
.
parameter_list
)
>
0
:
self
.
_create
ParameterUI
()
self
.
_create
GeometryColorPicker
()
self
.
_createColor
Maps
()
self
.
_createBgColorPickerButton
()
self
.
_parametersWidget
.
layout
().
addStretch
()
# Disconnect mouse signals
def
_disconnectMouseSignals
(
self
):
...
...
@@ -874,21 +893,24 @@ class MainWindow(QMainWindow):
if
not
hasLayer
:
layers
.
append
(
base_query
)
if
len
(
layers
)
==
0
or
len
(
dd
.
keys
())
==
0
:
self
.
_displayWidget
.
setPixmap
(
None
)
self
.
_displayWidget
.
setAlignment
(
Qt
.
AlignCenter
)
return
#send queries to the store to obtain images
lcnt
=
0
for
l
in
range
(
0
,
len
(
layers
)):
layers
[
l
].
loadImages
(
self
.
_store
)
lcnt
+=
1
if
len
(
layers
)
==
0
:
self
.
_displayWidget
.
setPixmap
(
None
)
self
.
_displayWidget
.
setAlignment
(
Qt
.
AlignCenter
)
return
c
=
Compositor
()
c
.
set_lookup_table
(
self
.
lookup_table
)
c
.
set_fill_color
(
self
.
_geometryColor
,
self
.
_useGeometryColor
)
c
.
set_background_color
(
self
.
_bgColor
)
#print "RENDER ", len(layers), hasLayer
c0
=
c
.
render
(
layers
,
hasLayer
)
# show the result
...
...
cinema_logo_icon_black.icns
0 → 100644
View file @
249eb4ad
File added
cinema_logo_icon_black.ico
0 → 100644
View file @
249eb4ad
361 KB
setup.py
View file @
249eb4ad
...
...
@@ -11,10 +11,13 @@ sys.path.insert(0, '/usr/local/lib/')
print
sys
.
path
OPTIONS
=
{
'argv_emulation'
:
True
'includes'
:
[
'PySide.QtCore'
,
'PySide.QtGui'
],
'iconfile'
:
"cinema_logo_icon_black.icns"
,
}
setup
(
app
=
[
"Cinema.py"
],
setup_requires
=
[
"py2app"
],
data_files
=
[(
'.'
,[
"builtin_tables.json"
])],
options
=
{
'py2app'
:
OPTIONS
},
)
setup_cxfreeze.py
0 → 100644
View file @
249eb4ad
"""
cxfreeze build script for Cinema_Qt-Viewer
Ubuntu-12.04.5 (tested with cx_Freeze 4.0.1)
-------------------------------------------
Currently not working, cx_Freeze has issues iterating over the paths ('NoneType' object
is not iterable). Use command line tool instead:
$ cxfreeze --default-path=/usr/local/lib/python2.7/dist-packages/:/usr/lib/python2.7:/home/alvaro/workspace/source/cinema_python/ --include-modules=PySide.QtCore,PySide.QtGui,cinema_python,encodings.hex_codec,numpy --include-path=/usr/lib/python2.7/dist-packages Cinema.py
@Note There is no parameter available in the command line tool to pass an icon.
Windows 7 - x64 (tested with cx_Freeze 4.3.4)
---------------------------------------------
Installed all packages with Anaconda. Script works, run from within the anaconda environment:
> ipython setup_cxfreeze.py build
@Note In either case, builtin_tables.json needs to be copied manually to the executable directory for the
application to run.
"""
import
sys
from
cx_Freeze
import
setup
,
Executable
import
os
# test again in Ubuntu after the meaningful error messages that helped fix the script using cxfreeze 4.3.4
# Options: http://cx-freeze.readthedocs.org/en/latest/distutils.html#build-exe
build_exe_options
=
{
"includes"
:
[
"PySide.QtCore"
,
"PySide.QtGui"
,
"cinema_python"
,
"encodings.hex_codec"
,
"numpy"
],
#"path" : ["/usr/lib/python2.7", "/usr/local/lib/python2.7/dist-packages", "/usr/lib/python2.7/dist-packages", "/home/alvaro/workspace/source/cinema_python"],
#"replace_paths" : [],
#"packages" : [],
#"excludes" : [],
"icon"
:
"cinema_logo_icon_black.ico"
}
# GUI applications require a different base on Windows (the default is for a
# console application).
base
=
None
if
sys
.
platform
==
"win32"
:
base
=
"Win32GUI"
setup
(
name
=
"Cinema"
,
version
=
"2"
,
description
=
"Viewer for Cinema databases"
,
options
=
{
"build_exe"
:
build_exe_options
},
executables
=
[
Executable
(
"Cinema.py"
,
base
=
base
)])
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment