Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PythonQt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
PythonQt
Commits
c1d710b4
Commit
c1d710b4
authored
7 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix Matplotlib backend
* calls to connect function * minor changes
parent
a88ec036
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
matplotlib/backends/backend_qt4.py
+24
-28
24 additions, 28 deletions
matplotlib/backends/backend_qt4.py
matplotlib/backends/backend_qt4agg.py
+1
-1
1 addition, 1 deletion
matplotlib/backends/backend_qt4agg.py
matplotlib/backends/qt4_compat.py
+2
-2
2 additions, 2 deletions
matplotlib/backends/qt4_compat.py
with
27 additions
and
31 deletions
matplotlib/backends/backend_qt4.py
+
24
−
28
View file @
c1d710b4
...
...
@@ -49,14 +49,14 @@ def _create_qApp():
Only one qApp can exist at a time, so check before creating one.
"""
return
# Disabled
for MeVisLab,
since QApplication is already there
# Disabled since QApplication is already there
if
QtGui
.
QApplication
.
startingUp
():
if
DEBUG
:
print
"
Starting up QApplication
"
global
qApp
app
=
QtGui
.
QApplication
.
instance
()
if
app
is
None
:
qApp
=
QtGui
.
QApplication
(
[
"
"
]
)
QtCore
.
QObject
.
connect
(
qApp
,
QtCore
.
SIGNAL
(
"
lastWindowClosed()
"
),
qApp
.
connect
(
QtCore
.
SIGNAL
(
"
lastWindowClosed()
"
),
qApp
,
QtCore
.
SLOT
(
"
quit()
"
)
)
else
:
qApp
=
app
...
...
@@ -98,13 +98,13 @@ class TimerQT(TimerBase):
# Create a new timer and connect the timeout() signal to the
# _on_timer method.
self
.
_timer
=
QtCore
.
QTimer
()
QtCore
.
QObject
.
connect
(
self
.
_timer
,
QtCore
.
SIGNAL
(
'
timeout()
'
),
self
.
_timer
.
connect
(
QtCore
.
SIGNAL
(
'
timeout()
'
),
self
.
_on_timer
)
def
__del__
(
self
):
# Probably not necessary in practice, but is good behavior to disconnect
TimerBase
.
__del__
(
self
)
QtCore
.
QObject
.
disconnect
(
self
.
_timer
,
QtCore
.
SIGNAL
(
'
timeout()
'
),
self
.
_timer
.
disconnect
(
QtCore
.
SIGNAL
(
'
timeout()
'
),
self
.
_on_timer
)
def
_timer_set_single_shot
(
self
):
...
...
@@ -142,7 +142,7 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
w
,
h
=
self
.
get_width_height
()
self
.
resize
(
w
,
h
)
QtCore
.
QObject
.
connect
(
self
,
QtCore
.
SIGNAL
(
'
destroyed()
'
),
self
.
connect
(
QtCore
.
SIGNAL
(
'
destroyed()
'
),
self
.
close_event
)
def
__timerEvent
(
self
,
event
):
...
...
@@ -217,10 +217,12 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
QtGui
.
QWidget
.
resizeEvent
(
self
,
event
)
def
sizeHint
(
self
):
if
DEBUG
:
print
"
FigureCanvasQt.sizeHint()
"
w
,
h
=
self
.
get_width_height
()
return
QtCore
.
QSize
(
w
,
h
)
def
minumumSizeHint
(
self
):
if
DEBUG
:
print
"
FigureCanvasQt.minumumSizeHint()
"
return
QtCore
.
QSize
(
10
,
10
)
def
_get_key
(
self
,
event
):
...
...
@@ -269,7 +271,11 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
def
idle_draw
(
*
args
):
self
.
draw
()
self
.
_idle
=
True
if
d
:
QtCore
.
QTimer
.
singleShot
(
0
,
idle_draw
)
if
d
:
if
QtCore
.
QTimer
.
singleShot
:
QtCore
.
QTimer
.
singleShot
(
0
,
idle_draw
)
else
:
idle_draw
()
class
MainWindowQt
(
QtGui
.
QMainWindow
):
def
__init__
(
self
):
...
...
@@ -300,7 +306,7 @@ class FigureManagerQT( FigureManagerBase ):
self
.
canvas
.
setFocusPolicy
(
QtCore
.
Qt
.
ClickFocus
)
self
.
canvas
.
setFocus
()
QtCore
.
QObject
.
connect
(
self
.
window
,
QtCore
.
SIGNAL
(
'
destroyed()
'
),
self
.
window
.
connect
(
QtCore
.
SIGNAL
(
'
destroyed()
'
),
self
.
_widgetclosed
)
self
.
window
.
_destroying
=
False
...
...
@@ -371,7 +377,7 @@ class FigureManagerQT( FigureManagerBase ):
def
destroy
(
self
,
*
args
):
if
self
.
window
.
_destroying
:
return
self
.
window
.
_destroying
=
True
QtCore
.
QObject
.
disconnect
(
self
.
window
,
QtCore
.
SIGNAL
(
'
destroyed()
'
),
self
.
window
.
disconnect
(
QtCore
.
SIGNAL
(
'
destroyed()
'
),
self
.
_widgetclosed
)
if
self
.
toolbar
:
self
.
toolbar
.
destroy
()
if
DEBUG
:
print
"
destroy figure manager
"
...
...
@@ -558,17 +564,13 @@ class SubplotToolQt( SubplotTool, QtGui.QWidget ):
self
.
sliderhspace
=
QtGui
.
QSlider
(
QtCore
.
Qt
.
Vertical
)
# constraints
QtCore
.
QObject
.
connect
(
self
.
sliderleft
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderleft
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderright
.
setMinimum
)
QtCore
.
QObject
.
connect
(
self
.
sliderright
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderright
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderleft
.
setMaximum
)
QtCore
.
QObject
.
connect
(
self
.
sliderbottom
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderbottom
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
slidertop
.
setMinimum
)
QtCore
.
QObject
.
connect
(
self
.
slidertop
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
slidertop
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderbottom
.
setMaximum
)
sliders
=
(
self
.
sliderleft
,
self
.
sliderbottom
,
self
.
sliderright
,
...
...
@@ -632,23 +634,17 @@ class SubplotToolQt( SubplotTool, QtGui.QWidget ):
self
.
sliderhspace
.
setSliderPosition
(
\
int
(
targetfig
.
subplotpars
.
hspace
*
1000
))
QtCore
.
QObject
.
connect
(
self
.
sliderleft
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderleft
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
funcleft
)
QtCore
.
QObject
.
connect
(
self
.
sliderbottom
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderbottom
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
funcbottom
)
QtCore
.
QObject
.
connect
(
self
.
sliderright
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderright
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
funcright
)
QtCore
.
QObject
.
connect
(
self
.
slidertop
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
slidertop
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
functop
)
QtCore
.
QObject
.
connect
(
self
.
sliderwspace
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderwspace
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
funcwspace
)
QtCore
.
QObject
.
connect
(
self
.
sliderhspace
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
sliderhspace
.
connect
(
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
funchspace
)
def
funcleft
(
self
,
val
):
...
...
This diff is collapsed.
Click to expand it.
matplotlib/backends/backend_qt4agg.py
+
1
−
1
View file @
c1d710b4
...
...
@@ -8,7 +8,7 @@ import os, sys
import
matplotlib
from
matplotlib.figure
import
Figure
from
backend_agg
import
FigureCanvasAgg
from
matplotlib.backends.
backend_agg
import
FigureCanvasAgg
from
backend_qt4
import
QtCore
,
QtGui
,
FigureManagerQT
,
FigureCanvasQT
,
\
show
,
draw_if_interactive
,
backend_version
,
\
NavigationToolbar2QT
...
...
This diff is collapsed.
Click to expand it.
matplotlib/backends/qt4_compat.py
+
2
−
2
View file @
c1d710b4
...
...
@@ -5,7 +5,7 @@ import os
from
matplotlib
import
rcParams
,
verbose
# Available APIs.
QT_API_P
ythonQt
=
'
PythonQt
'
QT_API_P
YTHONQT
=
'
PythonQt
'
QT_API_PYQT
=
'
PyQt4
'
# API is not set here; Python 2.x default is V 1
QT_API_PYQTv2
=
'
PyQt4v2
'
# forced to Version 2 API
QT_API_PYSIDE
=
'
PySide
'
# only supports Version 2 API
...
...
@@ -93,7 +93,7 @@ elif QT_API == QT_API_PYSIDE: # can only be pyside
"
Matplotlib backend_qt4 and backend_qt4agg require PySide >=1.0.3
"
)
_get_save
=
QtGui
.
QFileDialog
.
getSaveFileName
el
se
:
el
if
QT_API
==
QT_API_PYTHONQT
:
from
PythonQt
import
QtCore
,
QtGui
__version__
=
"
2.0
"
__version_info__
=
"
-
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment