Skip to content

Commit d4c4beb

Browse files
committed
code cleaning/refactoring
1 parent 7235760 commit d4c4beb

File tree

4 files changed

+26
-70
lines changed

4 files changed

+26
-70
lines changed

plugins/imageplotplugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright © 2009-2010 CEA
4-
# Pierre Raybaut
5-
# Licensed under the terms of the CECILL License
6-
# (see guiqwt/__init__.py for details)
3+
# Copyright © 2013 Pierre Raybaut
4+
# Licensed under the terms of the MIT License
75

86
"""
97
imageplotplugin

plugins/matplotlibplugin.py

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,21 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright © 2009 Pierre Raybaut
3+
# Copyright © 2013 Pierre Raybaut
44
# Licensed under the terms of the MIT License
55

6-
from PyQt4.QtGui import QIcon
7-
from PyQt4.QtDesigner import QPyDesignerCustomWidgetPlugin
6+
"""
7+
matplotlibplugin
8+
================
89
9-
import os
10-
from matplotlib import rcParams
11-
from matplotlibwidget import MatplotlibWidget
12-
13-
rcParams['font.size'] = 9
14-
15-
class MatplotlibPlugin(QPyDesignerCustomWidgetPlugin):
16-
def __init__(self, parent=None):
17-
QPyDesignerCustomWidgetPlugin.__init__(self)
18-
19-
self._initialized = False
20-
21-
def initialize(self, formEditor):
22-
if self._initialized:
23-
return
24-
25-
self._initialized = True
26-
27-
def isInitialized(self):
28-
return self._initialized
29-
30-
def createWidget(self, parent):
31-
return MatplotlibWidget(parent)
10+
A Matplotlib widget plugin for Qt Designer
11+
"""
3212

33-
def name(self):
34-
return "MatplotlibWidget"
35-
36-
def group(self):
37-
return "Python(x,y)"
38-
39-
def icon(self):
40-
image = os.path.join(rcParams['datapath'], 'images', 'matplotlib.png')
41-
return QIcon(image)
42-
43-
def toolTip(self):
44-
return ""
45-
46-
def whatsThis(self):
47-
return ""
48-
49-
def isContainer(self):
50-
return False
51-
52-
def domXml(self):
53-
return '<widget class="MatplotlibWidget" name="mplwidget">\n' \
54-
'</widget>\n'
55-
56-
def includeFile(self):
57-
return "matplotlibwidget"
13+
import os.path as osp
5814

15+
from matplotlib import rcParams
16+
rcParams['font.size'] = 9
5917

60-
if __name__ == '__main__':
61-
import sys
62-
from PyQt4.QtGui import QApplication
63-
app = QApplication(sys.argv)
64-
widget = MatplotlibWidget()
65-
widget.show()
66-
sys.exit(app.exec_())
18+
from guiqwt.qtdesigner import create_qtdesigner_plugin
19+
Plugin = create_qtdesigner_plugin("Matplotlib", "matplotlibwidget",
20+
"MatplotlibWidget",
21+
icon=osp.join(rcParams['datapath'], 'images', 'matplotlib.png'))

plugins/plotplugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright © 2009-2010 CEA
4-
# Pierre Raybaut
5-
# Licensed under the terms of the CECILL License
6-
# (see guiqwt/__init__.py for details)
3+
# Copyright © 2013 Pierre Raybaut
4+
# Licensed under the terms of the MIT License
75

86
"""
97
plotplugin

setup.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ def get_data_files(dirname):
1313
flist.append(osp.join(dirpath, fname))
1414
return flist
1515

16-
setup(name='PyQtdesignerplugins', version='1.0',
17-
description='PyQtdesignerplugins installs Qt Designer plugins for PyQt4',
18-
long_description="""PyQtdesignerplugins installs Python Qt designer plugins (Matplotlib, guiqwt, ...) in PyQt4 directory""",
16+
PROJECT_NAME = 'PyQtdesignerplugins'
17+
18+
setup(name=PROJECT_NAME, version='1.1',
19+
description='%s installs Qt Designer plugins for PyQt4' % PROJECT_NAME,
20+
long_description="""%s installs Python Qt designer plugins (Matplotlib, guiqwt, ...) in PyQt4 directory.
21+
22+
%s is part of the WinPython distribution project.
23+
""" % (PROJECT_NAME, PROJECT_NAME),
1924
py_modules = ['matplotlibwidget'],
2025
data_files=[(r'Lib\site-packages\PyQt4\plugins\designer\python', get_data_files('plugins'))],
2126
requires=["PyQt4 (>4.3)",],
2227
author = "Pierre Raybaut",
2328
author_email = 'pierre.raybaut@gmail.com',
24-
url = 'http://code.google.com/p/winpython/',
29+
url = 'http://winpython.sourceforge.net/',
2530
classifiers=['Operating System :: Microsoft :: Windows'])

0 commit comments

Comments
 (0)