Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mockup/prototype of a toolbarified page bar in okular
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
app = QApplication(sys.argv)
window = QMainWindow()
window.setCentralWidget(QTextEdit("""Content goes here.
The spacers centering the former bottom bar's contents
could mabe be only added if the bar is alone in a row.'"""))
topbar = QToolBar("Main Toolbar")
topbar.addAction(QIcon.fromTheme("document-open"), "Open")
topbar.addAction(QIcon.fromTheme("document-print"), "Print")
topbar.addAction(QIcon.fromTheme("document-save-as"), "Save as")
topbar.addSeparator()
topbar.addWidget(QLabel("...and more stuff"))
window.addToolBar(Qt.TopToolBarArea, topbar)
bottombar = QToolBar("Page Bar")
spacer1 = QWidget()
spacer1.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
bottombar.addWidget(spacer1)
bottombar.addAction(QIcon.fromTheme("arrow-left"), "Back")
smalledit = QLineEdit("5")
smalledit.setFixedWidth(32)
bottombar.addWidget(smalledit)
bottombar.addWidget(QLabel("of"))
pagebtn = QPushButton("40")
pagebtn.setFlat(True)
bottombar.addWidget(pagebtn)
bottombar.addAction(QIcon.fromTheme("arrow-right"), "Forward")
spacer2 = QWidget()
spacer2.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
bottombar.addWidget(spacer2)
window.addToolBar(Qt.BottomToolBarArea, bottombar)
window.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment