Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.80 KB | None | 0 0
  1. import json, pickle, sys
  2. from PyQt5.QtWidgets import QApplication, QWidget,QTabWidget, QPushButton, QVBoxLayout, QMainWindow,QPushButton, QAction, QLabel, QDialog
  3. from PyQt5.QtGui import QIcon
  4. from PyQt5.QtCore import pyqtSlot
  5. #  Req : Gui
  6. #      : Needs to be able to set network address's of computers that need the configuration files to sync , auto- updater?
  7. #
  8. class Application(QMainWindow):
  9.     def __init__(self):
  10.         super().__init__()
  11.         self.title = "Hot Rack - Food Management"
  12.         self.height = 600
  13.         self.width = 640
  14.         self.left = 500
  15.         self.top = 300
  16.         self.init_gui()
  17.  
  18.     def init_gui(self):
  19.         self.setWindowTitle(self.title)
  20.         self.setGeometry(self.left,self.top,self.width, self.height)
  21.         self.statusBar().showMessage('')
  22.  
  23.         #Menu's
  24.         main_menu = self.menuBar()
  25.         file_menu = main_menu.addMenu('File')
  26.         admin_login = QAction('Login', self)
  27.         exit_button = QAction(QIcon('exit24.png'), 'Exit', self)
  28.         exit_button.setShortcut('Ctrl+Q')
  29.         exit_button.setStatusTip('Exit application')
  30.         admin_login.setStatusTip('Admin login')
  31.         #admin_login.triggered.connect()
  32.         exit_button.triggered.connect(self.close)
  33.         file_menu.addAction(admin_login)
  34.         file_menu.addAction(exit_button)
  35.         self.rack_display = Rack_Display(self)
  36.         self.setCentralWidget(self.rack_display)
  37.         # Layout
  38.         self.show()
  39.  
  40. class Rack_Display(QWidget):
  41.    
  42.     def __init(self, parent):
  43.         super(QWidget,self).__init__(parent)
  44.         self.layout = QVBoxLayout()
  45.         #Tabs Initalization
  46.         self.tabs = QTabWidget()
  47.         self.day = QWidget()
  48.         self.week = QWidget()
  49.         self.tabs.resize(300,200)
  50.  
  51.         #Add tabs
  52.         self.tabs.addTab(self.day,"Day View")
  53.         self.tabs.addTab(self.week,"Week View")
  54.  
  55.         #Layout- Tab1
  56.         self.day.layout = QVBoxLayout(self)
  57.         self.pb = QPushButton('Enter text')
  58.         self.day.layout.addWidget(self.pb)
  59.         self.day.setLayout(self.day.layout)
  60.         #Layout - Tab2
  61.         self.week.layout = QVBoxLayout(self)
  62.         self.pushButton1 = QPushButton("PyQt5 button")
  63.         self.week.layout.addWidget(self.pushButton1)
  64.         self.week.setLayout(self.week.layout)
  65.         #Add tab widgets and layout
  66.         self.layout.addWidget((self.tabs))
  67.         self.setLayout(self.layout)
  68.  
  69.         @pyqtSlot()
  70.         def on_click(self):
  71.             print("\n")
  72.             for currentQTableWidgetItem in self.tableWidget.selectedItems():
  73.  
  74.                 print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())
  75. if __name__ == '__main__':
  76.     app = QApplication([sys.argv])
  77.     application = Application()
  78.     sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement