File: icon_example.py

package info (click to toggle)
taurus 4.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 99,944 kB
  • sloc: python: 52,365; sh: 21; makefile: 12
file content (29 lines) | stat: -rw-r--r-- 727 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from taurus.external.qt import Qt
from taurus.qt.qtgui.application import TaurusApplication


class MyGUI(Qt.QMainWindow):

    def __init__(self, parent=None):
        Qt.QMainWindow.__init__(self, parent)
        toolbar = self.addToolBar("Tools")

        # get icon from theme
        icon1 = Qt.QIcon.fromTheme("document-open")

        # get icon using prefix + filename
        icon2 = Qt.QIcon("actions:exit.svg")

        toolbar.addAction(icon1, "Open HDF5", self.open_file)
        toolbar.addAction(icon2, "Exit", self.close)


    def open_file(self):
        pass   # do something

if __name__ == "__main__":
    import sys
    app = TaurusApplication()
    gui = MyGUI()
    gui.show()
    sys.exit(app.exec_())