Esempio n. 1
0
	def __init__(self, rfid_thread, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.rfid_thread = rfid_thread

		# Define url's
		self.home_url = QtCore.QUrl(settings.ADMIN_TAB_URL)
		self.logout_url = QtCore.QUrl(settings.ADMIN_TAB_URL + "logout/")

		# Views:
		self.home_button = QtGui.QPushButton(getIcon("home", 32), "", self)
		self.back_button = QtGui.QPushButton(getIcon("back", 32), "", self)
		self.next_button = QtGui.QPushButton(getIcon("next", 32), "", self)
		self.lock_button = QtGui.QPushButton(getIcon("lock", 32), "Log out",
				self)
		self.lock_button.setEnabled(False)
		self.web = QtWebKit.QWebView()

		self.home_button.clicked.connect(self.home)
		self.back_button.clicked.connect(self.back)
		self.next_button.clicked.connect(self.next)
		self.lock_button.clicked.connect(self.logout)
		self.web.urlChanged.connect(self.urlChanged)
		self.home()


		# Layout:
		grid = QtGui.QGridLayout(self)

		# QSizePolicy(hor, vert)
		small = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
				QtGui.QSizePolicy.Fixed)

		self.home_button.setSizePolicy(small)
		self.back_button.setSizePolicy(small)
		self.next_button.setSizePolicy(small)
		self.lock_button.setSizePolicy(small)

		# addWidget(row, col, row-size, col-size, align)
		grid.addWidget(self.home_button, 0, 0)
		grid.addWidget(self.back_button, 0, 1)
		grid.addWidget(self.next_button, 0, 2)
		grid.addWidget(self.lock_button, 0, 4, 1, 1, QtCore.Qt.AlignRight)
		grid.addWidget(self.web, 1, 0, 1, 5)
		self.setLayout(grid)

		# Connect signals:
		if parent != None:
			self.parentWidget().currentChanged.connect(self.tabChanged)
		self.rfid_thread.rfid_signal.connect(self.rfidEvent)
Esempio n. 2
0
	def _setStyle(self, style):
		self.setObjectName(style[0])
		self.setIcon(getIcon(style[1]))
		# Force style update:
		st = self.style()
		self.setStyle(st)