Skip to content

Commit

Permalink
gui: add logo to MDI area
Browse files Browse the repository at this point in the history
sbourdeauducq committed Feb 21, 2016
1 parent fc47d8c commit 95dbafd
Showing 3 changed files with 118 additions and 2 deletions.
17 changes: 15 additions & 2 deletions artiq/frontend/artiq_gui.py
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ def get_argparser():
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, server):
QtWidgets.QMainWindow.__init__(self)
icon = QtGui.QIcon(os.path.join(artiq_dir, "gui", "icon.png"))
icon = QtGui.QIcon(os.path.join(artiq_dir, "gui", "logo.svg"))
self.setWindowIcon(icon)
self.setWindowTitle("ARTIQ - {}".format(server))
self.exit_request = asyncio.Event()
@@ -56,6 +56,19 @@ def restore_state(self, state):
self.restoreState(QtCore.QByteArray(state["state"]))


class MdiArea(QtWidgets.QMdiArea):
def __init__(self):
QtWidgets.QMdiArea.__init__(self)
self.pixmap = QtGui.QPixmap(os.path.join(artiq_dir, "gui", "logo.svg"))

def paintEvent(self, event):
QtWidgets.QMdiArea.paintEvent(self, event)
painter = QtGui.QPainter(self.viewport())
x = (self.width() - self.pixmap.width())//2
y = (self.height() - self.pixmap.height())//2
painter.drawPixmap(x, y, self.pixmap)


def main():
# initialize application
args = get_argparser().parse_args()
@@ -93,7 +106,7 @@ def main():
status_bar = QtWidgets.QStatusBar()
status_bar.showMessage("Connected to {}".format(args.server))
main_window.setStatusBar(status_bar)
mdi_area = QtWidgets.QMdiArea()
mdi_area = MdiArea()
mdi_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
mdi_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
main_window.setCentralWidget(mdi_area)
Binary file removed artiq/gui/icon.png
Binary file not shown.
103 changes: 103 additions & 0 deletions artiq/gui/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 95dbafd

Please sign in to comment.