Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. from PySide.QtCore import *
  2. from PySide.QtGui import *
  3. from PySide.QtUiTools import QUiLoader
  4. from Trader.core.outpost import Outpost
  5.  
  6.  
  7. def loadui(file_name):
  8.     loader = QUiLoader()
  9.     uifile = QFile(file_name)
  10.     uifile.open(QFile.ReadOnly)
  11.     ui = loader.load(uifile)
  12.     uifile.close()
  13.     return ui
  14.  
  15.  
  16. def create_topic(data):
  17.     box = QGroupBox()
  18.     grid = QGridLayout()
  19.     nickname = QTextEdit()
  20.  
  21.     box.setFixedHeight(200)
  22.     nickname.setText(data)
  23.  
  24.     grid.addWidget(nickname)
  25.     box.setLayout(grid)
  26.  
  27.     return box
  28.  
  29.  
  30. if __name__ == "__main__":
  31.     import sys
  32.  
  33.     app = QApplication(sys.argv)
  34.     MainWindow = loadui("main.ui")
  35.     MainWindow.vlay.setAlignment(Qt.AlignTop)
  36.     timer = QTimer()
  37.     timer.start(5000)
  38.  
  39.     def create(outpost):
  40.         widg = create_topic(outpost.trades + " : " + outpost.posts)
  41.         MainWindow.vlay.addWidget(widg)
  42.  
  43.     def output_slot():
  44.         outpost = Outpost('12345')
  45.         outpost.finished.connect(create(outpost))
  46.  
  47.     timer.timeout.connect(output_slot)
  48.  
  49.     MainWindow.show()
  50.     app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement