bugfix: modified icon management and corrected usage of references

This commit is contained in:
Sebastian Wehling-Benatelli 2015-04-02 18:36:21 +02:00
parent 0824026159
commit e35d6b9371
6 changed files with 50 additions and 32 deletions

View File

@ -29,7 +29,7 @@ from PySide.QtCore import QCoreApplication, QSettings, Signal, QFile, \
QFileInfo, Qt QFileInfo, Qt
from PySide.QtGui import QMainWindow, QInputDialog, QIcon, QFileDialog, \ from PySide.QtGui import QMainWindow, QInputDialog, QIcon, QFileDialog, \
QWidget, QHBoxLayout, QStyle, QKeySequence, QLabel, QFrame, QAction, \ QWidget, QHBoxLayout, QStyle, QKeySequence, QLabel, QFrame, QAction, \
QDialog, QErrorMessage, QApplication QDialog, QErrorMessage, QApplication, QPixmap
from obspy.core import UTCDateTime from obspy.core import UTCDateTime
from pylot.core.read import Data, FilterOptions from pylot.core.read import Data, FilterOptions
@ -38,12 +38,11 @@ from pylot.core.util import _getVersionString, FILTERDEFAULTS, fnConstructor, \
NewEventDlg, createEvent, MPLWidget, PropertiesDlg, HelpForm, \ NewEventDlg, createEvent, MPLWidget, PropertiesDlg, HelpForm, \
DatastructureError, createAction, getLogin, createCreationInfo, PickDlg DatastructureError, createAction, getLogin, createCreationInfo, PickDlg
from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.structure import DATASTRUCTURE
import qrc_resources import icons_rc
# Version information # Version information
__version__ = _getVersionString() __version__ = _getVersionString()
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
closing = Signal() closing = Signal()
@ -101,8 +100,11 @@ class MainWindow(QMainWindow):
except: except:
self.startTime = UTCDateTime() self.startTime = UTCDateTime()
pylot_icon = QIcon()
pylot_icon.addPixmap(QPixmap(':/icons/pylot.ico'))
self.setWindowTitle("PyLoT - do seismic processing the python way") self.setWindowTitle("PyLoT - do seismic processing the python way")
self.setWindowIcon(QIcon(":/icon.ico")) self.setWindowIcon(pylot_icon)
xlab = self.startTime.strftime('seconds since %Y/%m/%d %H:%M:%S (%Z)') xlab = self.startTime.strftime('seconds since %Y/%m/%d %H:%M:%S (%Z)')
@ -123,7 +125,15 @@ class MainWindow(QMainWindow):
saveIcon = self.style().standardIcon(QStyle.SP_DriveHDIcon) saveIcon = self.style().standardIcon(QStyle.SP_DriveHDIcon)
helpIcon = self.style().standardIcon(QStyle.SP_DialogHelpButton) helpIcon = self.style().standardIcon(QStyle.SP_DialogHelpButton)
newIcon = self.style().standardIcon(QStyle.SP_FileIcon) newIcon = self.style().standardIcon(QStyle.SP_FileIcon)
pickIcon = QIcon(':/pick.png')
# create resource icons
p_icon = QIcon()
p_icon.addPixmap(QPixmap(':/icons/picon.png'))
s_icon = QIcon()
s_icon.addPixmap(QPixmap(':/icons/sicon.png'))
print_icon = QIcon()
print_icon.addPixmap(QPixmap(':/icons/printer.png'))
newEventAction = self.createAction(self, "&New event ...", newEventAction = self.createAction(self, "&New event ...",
self.createNewEvent, self.createNewEvent,
QKeySequence.New, newIcon, QKeySequence.New, newIcon,
@ -163,14 +173,14 @@ class MainWindow(QMainWindow):
"Alt+F", QIcon(None), "Alt+F", QIcon(None),
"""Adjust filter parameters.""") """Adjust filter parameters.""")
self.selectPAction = self.createAction(self, "&P", self.alterPhase, "Alt+P", self.selectPAction = self.createAction(self, "&P", self.alterPhase, "Alt+P",
QIcon(":/picon.png"), p_icon,
"Toggle P phase.", True) "Toggle P phase.", True)
self.selectSAction = self.createAction(self, "&S", self.alterPhase, "Alt+S", self.selectSAction = self.createAction(self, "&S", self.alterPhase, "Alt+S",
QIcon(":/sicon.png"), s_icon,
"Toggle S phase", True) "Toggle S phase", True)
printAction = self.createAction(self, "&Print event ...", printAction = self.createAction(self, "&Print event ...",
self.printEvent, QKeySequence.Print, self.printEvent, QKeySequence.Print,
QIcon(":/printer.png"), print_icon,
"Print waveform overview.") "Print waveform overview.")
helpAction = self.createAction(self, "&Help ...", self.helpHelp, helpAction = self.createAction(self, "&Help ...", self.helpHelp,
QKeySequence.HelpContents, helpIcon, QKeySequence.HelpContents, helpIcon,
@ -517,13 +527,16 @@ class MainWindow(QMainWindow):
def main(): def main():
# create the Qt application # create the Qt application
pylot_app = QApplication(sys.argv[0]) pylot_app = QApplication(sys.argv)
app_icon = QIcon()
app_icon.addPixmap(QPixmap(':/icons/pick.png'))
# set Application Information # set Application Information
pylot_app.setOrganizationName("Ruhr-University Bochum / MAGS2") pylot_app.setOrganizationName("Ruhr-University Bochum / MAGS2")
pylot_app.setOrganizationDomain("rub.de") pylot_app.setOrganizationDomain("rub.de")
pylot_app.setApplicationName("PyLoT") pylot_app.setApplicationName("PyLoT")
pylot_app.setWindowIcon(QIcon(":/icon.ico")) pylot_app.setWindowIcon(app_icon)
# create the main window # create the main window
pylot_form = MainWindow() pylot_form = MainWindow()

View File

@ -5,6 +5,7 @@
<file>icons/picon.png</file> <file>icons/picon.png</file>
<file>icons/sicon.png</file> <file>icons/sicon.png</file>
<file>icons/pick.png</file> <file>icons/pick.png</file>
<file>icons/filter.png</file>
</qresource> </qresource>
<qresource prefix="/help"> <qresource prefix="/help">
<file>help/index.html</file> <file>help/index.html</file>

BIN
icons/filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

21
icons_rc.py Normal file

File diff suppressed because one or more lines are too long

View File

@ -262,10 +262,14 @@ class PickDlg(QDialog):
def setupUi(self): def setupUi(self):
# create icons
filter_icon = QIcon()
filter_icon.addPixmap(QPixmap(':/icons/filter.png'))
# create actions # create actions
self.filterAction = createAction(parent=self, text='Filter', self.filterAction = createAction(parent=self, text='Filter',
slot=self.filterWFData, slot=self.filterWFData,
icon=QIcon(':/filter.png'), icon=filter_icon,
tip='Filter waveforms', tip='Filter waveforms',
checkable=True) checkable=True)
self.selectPhase = QComboBox() self.selectPhase = QComboBox()

File diff suppressed because one or more lines are too long