Skip to content

Commit

Permalink
Merge pull request #68 from megies/fix_window_icon
Browse files Browse the repository at this point in the history
fix qt app window icon
  • Loading branch information
megies authored Nov 10, 2017
2 parents 2fd2f0f + 5669a88 commit e306441
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ master
- make it possible to set default filter corners via config file (see #66)
- enable parallel event upload/replacement/deletion on seishub and jane
(see #67)
- fix Qt application Window icon (see #68)

0.5.0
- add support for magnitude estimation for data fetched from an FDSN server
Expand Down
43 changes: 39 additions & 4 deletions obspyck/obspyck.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
NAMESPACE = "http://erdbeben-in-bayern.de/xmlns/0.1"
NSMAP = {"edb": NAMESPACE}

ICON_PATH = os.path.join(os.path.dirname(
sys.modules[__name__].__file__), 'obspyck{}.gif')

if map(int, obspy.__version__.split('.')[:2]) < [1, 1]:
msg = "Needing ObsPy version >= 1.1.0 (current version is: {})"
Expand Down Expand Up @@ -117,6 +119,15 @@ def __init__(self, clients, streams, options, keys, config):
self.widgets = Ui_qMainWindow_obsPyck()
self.widgets.setupUi(self)

# set icon
app_icon = QtGui.QIcon()
app_icon.addFile(ICON_PATH.format("_16x16"), QtCore.QSize(16, 16))
app_icon.addFile(ICON_PATH.format("_24x42"), QtCore.QSize(24, 24))
app_icon.addFile(ICON_PATH.format("_32x32"), QtCore.QSize(32, 32))
app_icon.addFile(ICON_PATH.format("_48x48"), QtCore.QSize(48, 48))
app_icon.addFile(ICON_PATH.format(""), QtCore.QSize(64, 64))
self.setWindowIcon(app_icon)

# Create little color icons in front of the phase type combo box.
# Needs to be done pretty much at the beginning because some other
# stuff relies on the phase type being set.
Expand Down Expand Up @@ -647,7 +658,13 @@ def on_qToolButton_replaceEvent_clicked(self, *args):
except:
user = None
qMessageBox = QtGui.QMessageBox()
qMessageBox.setWindowIcon(QtGui.QIcon(QtGui.QPixmap("obspyck.gif")))
app_icon = QtGui.QIcon()
app_icon.addFile(ICON_PATH.format("_16x16"), QtCore.QSize(16, 16))
app_icon.addFile(ICON_PATH.format("_24x42"), QtCore.QSize(24, 24))
app_icon.addFile(ICON_PATH.format("_32x32"), QtCore.QSize(32, 32))
app_icon.addFile(ICON_PATH.format("_48x48"), QtCore.QSize(48, 48))
app_icon.addFile(ICON_PATH.format(""), QtCore.QSize(64, 64))
qMessageBox.setWindowIcon(app_icon)
qMessageBox.setIcon(QtGui.QMessageBox.Warning)
qMessageBox.setWindowTitle("Replace?")
qMessageBox.setText("Overwrite event in database?")
Expand Down Expand Up @@ -681,7 +698,13 @@ def on_qToolButton_deleteEvent_clicked(self, *args):
except:
user = None
qMessageBox = QtGui.QMessageBox()
qMessageBox.setWindowIcon(QtGui.QIcon(QtGui.QPixmap("obspyck.gif")))
app_icon = QtGui.QIcon()
app_icon.addFile(ICON_PATH.format("_16x16"), QtCore.QSize(16, 16))
app_icon.addFile(ICON_PATH.format("_24x42"), QtCore.QSize(24, 24))
app_icon.addFile(ICON_PATH.format("_32x32"), QtCore.QSize(32, 32))
app_icon.addFile(ICON_PATH.format("_48x48"), QtCore.QSize(48, 48))
app_icon.addFile(ICON_PATH.format(""), QtCore.QSize(64, 64))
qMessageBox.setWindowIcon(app_icon)
qMessageBox.setIcon(QtGui.QMessageBox.Warning)
qMessageBox.setWindowTitle("Delete?")
qMessageBox.setText("Delete event from database?")
Expand Down Expand Up @@ -4531,7 +4554,13 @@ def checkForSysopEventDuplicates(self, starttime, endtime):
self.error(err)
self.error(errlist)
qMessageBox = QtGui.QMessageBox()
qMessageBox.setWindowIcon(QtGui.QIcon(QtGui.QPixmap("obspyck.gif")))
app_icon = QtGui.QIcon()
app_icon.addFile(ICON_PATH.format("_16x16"), QtCore.QSize(16, 16))
app_icon.addFile(ICON_PATH.format("_24x42"), QtCore.QSize(24, 24))
app_icon.addFile(ICON_PATH.format("_32x32"), QtCore.QSize(32, 32))
app_icon.addFile(ICON_PATH.format("_48x48"), QtCore.QSize(48, 48))
app_icon.addFile(ICON_PATH.format(""), QtCore.QSize(64, 64))
qMessageBox.setWindowIcon(app_icon)
qMessageBox.setIcon(QtGui.QMessageBox.Critical)
qMessageBox.setWindowTitle("Possible Duplicate Public Event!")
qMessageBox.setText(err)
Expand Down Expand Up @@ -4576,7 +4605,13 @@ def popupBadEventError(self, msg):
" %s." % msg)
self.error(err)
qMessageBox = QtGui.QMessageBox()
qMessageBox.setWindowIcon(QtGui.QIcon(QtGui.QPixmap("obspyck.gif")))
app_icon = QtGui.QIcon()
app_icon.addFile(ICON_PATH.format("_16x16"), QtCore.QSize(16, 16))
app_icon.addFile(ICON_PATH.format("_24x42"), QtCore.QSize(24, 24))
app_icon.addFile(ICON_PATH.format("_32x32"), QtCore.QSize(32, 32))
app_icon.addFile(ICON_PATH.format("_48x48"), QtCore.QSize(48, 48))
app_icon.addFile(ICON_PATH.format(""), QtCore.QSize(64, 64))
qMessageBox.setWindowIcon(app_icon)
qMessageBox.setIcon(QtGui.QMessageBox.Critical)
qMessageBox.setWindowTitle("Public Event with Missing Information!")
qMessageBox.setText(err)
Expand Down
Binary file added obspyck/obspyck_16x16.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added obspyck/obspyck_24x24.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added obspyck/obspyck_32x32.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added obspyck/obspyck_48x48.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
]
}
PACKAGE_DATA = {
'obspyck': ['example.cfg', 'obspyck.gif']}
'obspyck': ['example.cfg', 'obspyck.gif', 'obspyck_16x16.gif',
'obspyck_24x24.gif', 'obspyck_32x32.gif', 'obspyck_48x48.gif']}

SETUP_DIRECTORY = os.path.dirname(os.path.abspath(inspect.getfile(
inspect.currentframe())))
Expand Down

0 comments on commit e306441

Please sign in to comment.