Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GEPARD
GEPARD
Commits
9b215a0d
Commit
9b215a0d
authored
Oct 14, 2020
by
Elisa Kanaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct __main__.py
parent
8020cfd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
15 deletions
+51
-15
__main__.py
__main__.py
+51
-15
No files found.
__main__.py
View file @
9b215a0d
...
...
@@ -18,36 +18,64 @@ You should have received a copy of the GNU General Public License
along with this program, see COPYING.
If not, see <https://www.gnu.org/licenses/>.
"""
import
logging
import
logging.handlers
import
traceback
import
os
from
io
import
StringIO
from
typing
import
List
from
PyQt5
import
QtCore
,
QtWidgets
,
QtGui
from
.sampleview
import
SampleView
from
.scalebar
import
ScaleBar
from
.ramancom.ramancontrol
import
defaultPath
from
.ramancom.ramanSwitch
import
RamanSwitch
from
.analysis.colorlegend
import
ColorLegend
from
.gui.scalebar
import
ScaleBar
from
.instrumentcom.instrumentConfig
import
defaultPath
from
.instrumentcom.lightModeSwitch
import
LightModeSwitch
from
.gui.colorlegend
import
ColorLegend
from
.gepardlogging
import
setDefaultLoggingConfig
from
.workmodes
import
ModeHandler
from
.unittests.test_gepard
import
testGepard
from
.helperfunctions
import
getAppFolder
from
gepard
import
__version__
def
excepthook
(
excType
,
excValue
,
tracebackobj
):
"""
Global function to catch unhandled exceptions.
@param excType exception type
@param excValue exception value
@param tracebackobj traceback object
:return:
"""
tbinfofile
=
StringIO
()
traceback
.
print_tb
(
tracebackobj
,
None
,
tbinfofile
)
tbinfofile
.
seek
(
0
)
tbinfo
=
tbinfofile
.
read
()
logging
.
critical
(
"Fatal error in program execution!"
)
logging
.
critical
(
tbinfo
)
from
.errors
import
showErrorMessageAsWidget
showErrorMessageAsWidget
(
tbinfo
)
class
GEPARDMainWindow
(
QtWidgets
.
QMainWindow
):
def
__init__
(
self
,
log
path
):
def
__init__
(
self
,
log
ger
):
super
(
GEPARDMainWindow
,
self
).
__init__
()
self
.
setWindowTitle
(
"GEPARD "
+
__version__
)
self
.
fname
:
str
=
''
self
.
resize
(
900
,
700
)
self
.
view
=
SampleView
(
logpath
)
self
.
view
.
imparent
=
self
self
.
view
.
ScalingChanged
.
connect
(
self
.
scalingChanged
)
self
.
scalebar
=
ScaleBar
(
self
)
self
.
legend
=
ColorLegend
(
self
)
self
.
ramanSwitch
=
RamanSwitch
(
self
)
self
.
lightModeSwitch
=
LightModeSwitch
(
self
)
self
.
view
=
SampleView
(
self
,
logger
)
self
.
view
.
ScalingChanged
.
connect
(
self
.
scalingChanged
)
self
.
view
.
ScalingChanged
.
connect
(
self
.
scalebar
.
updateScale
)
mdiarea
=
QtWidgets
.
QMdiArea
(
self
)
mdiarea
.
addSubWindow
(
self
.
scalebar
)
mdiarea
.
addSubWindow
(
self
.
legend
)
mdiarea
.
addSubWindow
(
self
.
raman
Switch
)
mdiarea
.
addSubWindow
(
self
.
lightMode
Switch
)
self
.
legend
.
hide
()
self
.
raman
Switch
.
hide
()
self
.
lightMode
Switch
.
hide
()
subview
=
mdiarea
.
addSubWindow
(
self
.
view
)
subview
.
showMaximized
()
...
...
@@ -123,8 +151,16 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
@
QtCore
.
pyqtSlot
()
def
about
(
self
):
QtWidgets
.
QMessageBox
.
about
(
self
,
'GEPARD'
,
"Developed by Complex Fiber Structures GmbH "
"on behalf of Leibniz-IPF Dresden"
)
devbranch
=
None
fname
=
os
.
path
.
join
(
os
.
path
.
split
(
__file__
)[
0
],
os
.
path
.
join
(
'.git'
,
'HEAD'
))
if
os
.
path
.
exists
(
fname
):
with
open
(
fname
,
'r'
)
as
fp
:
cont
=
fp
.
read
()
devbranch
=
cont
.
rsplit
(
'/'
,
maxsplit
=
1
)[
1
]
QtWidgets
.
QMessageBox
.
about
(
self
,
'GEPARD'
,
'Gepard-Enabled PARticle Detection for Raman and FTIR microscopes.
\n
Version:'
+
\
__version__
+
''
if
devbranch
is
None
else
(
'
\n
Development branch: '
+
devbranch
))
def
getParticleRelevantActs
(
self
)
->
List
[
QtWidgets
.
QAction
]:
return
[
self
.
noOverlayAct
,
self
.
selOverlayAct
,
self
.
fullOverlayAct
,
self
.
hideLabelAct
,
self
.
transpAct
,
self
.
darkenAct
,
self
.
seedAct
]
...
...
Write
Preview
Markdown
is supported
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