From 013c948b3362523186fcf8885b2a2f9d9253a6d3 Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Thu, 6 Nov 2014 15:05:56 +0100 Subject: [PATCH] fix convenience import problems --- pylot/__init__.py | 6 +----- pylot/core/util/__init__.py | 5 +++++ pylot/core/util/widgets.py | 28 ++++++++++++---------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/pylot/__init__.py b/pylot/__init__.py index 21263514..7e113674 100755 --- a/pylot/__init__.py +++ b/pylot/__init__.py @@ -24,8 +24,4 @@ The development of PyLoT is part of the joint research project MAGS2. :license: GNU Lesser General Public License, Version 3 (http://www.gnu.org/copyleft/lesser.html) -''' - -from obspy.core.utcdatetime import UTCDateTime -from pylot.core.read import * -from pylot.core.util import * +''' \ No newline at end of file diff --git a/pylot/core/util/__init__.py b/pylot/core/util/__init__.py index 2d62d12c..26b84168 100755 --- a/pylot/core/util/__init__.py +++ b/pylot/core/util/__init__.py @@ -2,5 +2,10 @@ from pylot.core.util.connection import checkurl from pylot.core.util.defaults import FILTERDEFAULTS from pylot.core.util.errors import OptionsError from pylot.core.util.utils import fnConstructor +from pylot.core.util.widgets import PickDlg +from pylot.core.util.widgets import HelpForm +from pylot.core.util.widgets import FilterOptionsDialog +from pylot.core.util.widgets import PropertiesDlg +from pylot.core.util.widgets import MPLWidget from pylot.core.util.version import get_git_version as _getVersionString diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index a0476cd0..4eb109dd 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -14,11 +14,9 @@ from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from PySide.QtGui import (QAction, QApplication, - QCheckBox, QComboBox, QDialog, QDialogButtonBox, - QDockWidget, QDoubleSpinBox, QGroupBox, QGridLayout, @@ -30,7 +28,6 @@ from PySide.QtGui import (QAction, QMessageBox, QSpinBox, QTabWidget, - QTextBrowser, QToolBar, QVBoxLayout, QWidget) @@ -38,7 +35,7 @@ from PySide.QtCore import (Qt, QUrl, SIGNAL, SLOT) -from pylot.core.util import OptionsError +from PySide.QtWebKit import QWebView from pylot.core.read import FilterOptions @@ -217,7 +214,6 @@ class FilterOptionsDialog(QDialog): self.updateUi) self.connect(self.selectTypeCombo, SIGNAL("currentIndexChanged(int)"), self.updateUi) - self.updateUi() def updateUi(self): if self.selectTypeCombo.currentText() not in ['bandpass', 'bandstop']: @@ -248,7 +244,7 @@ class FilterOptionsDialog(QDialog): return self.filterOptions def getFilterOptions(self): - return self.filterOptions + return self.filterOptions class LoadDataDlg(QDialog): @@ -261,8 +257,7 @@ class LoadDataDlg(QDialog): class HelpForm(QDialog): - def __init__(self, page='https://ariadne.geophysik.rub.de/trac/PyLoT/wiki', - parent=None): + def __init__(self, page=QUrl(':/help.html'), parent=None): super(HelpForm, self).__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) self.setAttribute(Qt.WA_GroupLeader) @@ -277,24 +272,25 @@ class HelpForm(QDialog): toolBar.addAction(backAction) toolBar.addAction(homeAction) toolBar.addWidget(self.pageLabel) - self.textBrowser = QTextBrowser() + self.webBrowser = QWebView() + self.webBrowser.setHtml(page) layout = QVBoxLayout() layout.addWidget(toolBar) - layout.addWidget(self.textBrowser, 1) + layout.addWidget(self.webBrowser, 1) self.setLayout(layout) self.connect(backAction, SIGNAL("triggered()"), - self.textBrowser, SLOT("backward()")) + self.webBrowser, SLOT("backward()")) self.connect(homeAction, SIGNAL("triggered()"), - self.textBrowser, SLOT("home()")) - self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"), + self.webBrowser, SLOT("home()")) + self.connect(self.webBrowser, SIGNAL("sourceChanged(QUrl)"), self.updatePageTitle) - self.textBrowser.setSearchPaths([":/help"]) - self.textBrowser.setSource(QUrl(page)) + self.webBrowser.setSearchPaths([":/help"]) + self.webBrowser.setSource(QUrl(page)) self.resize(400, 600) self.setWindowTitle("{0} Help".format(QApplication.applicationName())) def updatePageTitle(self): - self.pageLabel.setText(self.textBrowser.documentTitle()) + self.pageLabel.setText(self.webBrowser.documentTitle())