本文整理匯總了Python中GUI.setMode方法的典型用法代碼示例。如果您正苦於以下問題:Python GUI.setMode方法的具體用法?Python GUI.setMode怎麽用?Python GUI.setMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GUI
的用法示例。
在下文中一共展示了GUI.setMode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Widget
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import setMode [as 別名]
#.........這裏部分代碼省略.........
self.sld_timeout.setSingleStep(500)
self.sld_timeout.setPageStep(500)
self.sld_pkt.setRange(1, 120)
self.sld_pkt.setValue(60)
self.sld_pkt.setPageStep(1)
#Slider
self.title_wndSize = QtGui.QLabel('Marime fereastra')
self.title_e2eDelay = QtGui.QLabel('Intarziere End to end')
self.title_timeout = QtGui.QLabel('Valoare timeout')
self.title_pkt = QtGui.QLabel('Numar de pachete pe minut')
self.title_ptl = QtGui.QLabel('Protocol studiat')
self.title_emt = QtGui.QLabel('Pachete trimise automat')
#Initializare grid
grid = QtGui.QGridLayout()
grid.setSpacing(10)
grid.addWidget(self.title_ptl, 0, 0)
grid.addWidget(self.rbut_SR, 0, 1)
grid.addWidget(self.btn, 0, 2)
QtCore.QObject.connect(self.btn, QtCore.SIGNAL("clicked()"), self.Start)
QtCore.QObject.connect(self.rbut_SR, QtCore.SIGNAL("clicked()"), self.ModeSR)
grid.addWidget(self.title_wndSize, 2, 0)
grid.addWidget(self.sld_wndSize, 2, 1)
grid.addWidget(self.lcd_wndSize, 2, 2)
self.sld_wndSize.valueChanged.connect(self.lcd_wndSize.display)
self.sld_wndSize.valueChanged.connect(self.gui.setWndSize)
grid.addWidget(self.title_e2eDelay, 3, 0)
grid.addWidget(self.sld_e2eDelay, 3, 1)
grid.addWidget(self.lcd_e2eDelay, 3, 2)
self.sld_e2eDelay.valueChanged.connect(self.lcd_e2eDelay.display)
self.sld_e2eDelay.valueChanged.connect(self.gui.sete2eDelay)
grid.addWidget(self.title_timeout, 4, 0)
grid.addWidget(self.sld_timeout, 4, 1)
grid.addWidget(self.lcd_timeout, 4, 2)
self.sld_timeout.valueChanged.connect(self.lcd_timeout.display)
self.sld_timeout.valueChanged.connect(self.gui.settimeout)
grid.addWidget(self.title_pkt, 5, 0)
grid.addWidget(self.sld_pkt, 5, 1)
grid.addWidget(self.lcd_pkt, 5, 2)
self.sld_pkt.valueChanged.connect(self.lcd_pkt.display)
self.sld_pkt.valueChanged.connect(self.gui.setpkt)
grid.addWidget(self.title_emt, 7, 0)
grid.addWidget(self.gui, 8, 0, 5, 3)
self.setLayout(grid)
self.showMaximized()
self.setWindowTitle('Protocolul Selective Repeat ARQ')
self.show()
pass
def paintEvent(self, e):
qp = QtGui.QPainter()
qp.begin(self)
self.draw(qp)
qp.end()
pass
def draw(self, qp):
self.gui.draw(qp)
pass
def SendData(self):
pass
def Start(self):
if self.isStart == False:
self.gui.StartAction()
self.isStart = True
self.btn.setText('Stop')
pass
elif self.isStart == True:
self.gui.StopAction()
self.isStart = False
self.btn.setText('Start')
pass
pass
def ModeGBN(self):
self.gui.setMode(0)
pass
def ModeSR(self):
self.gui.setMode(1)
pass
def ModeScroll(self):
self.gui.setScrollMode(self.combx.currentIndex())
def keyPressEvent(self, e):
if e.key() == QtCore.Qt.Key_Escape:
self.close()
pass
示例2: Widget
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import setMode [as 別名]
#.........這裏部分代碼省略.........
#Slider
self.title_wndSize = QtGui.QLabel('window Size')
self.title_e2eDelay = QtGui.QLabel('end to end delay')
self.title_timeout = QtGui.QLabel('time out')
self.title_pkt = QtGui.QLabel('number of packets emited per minute')
self.title_ptl = QtGui.QLabel('protocol')
self.title_scrollmode = QtGui.QLabel('scroll mode')
self.title_emt = QtGui.QLabel('automatic emission of packets')
#grid Init
grid = QtGui.QGridLayout()
grid.setSpacing(10)
grid.addWidget(self.title_ptl, 0, 0)
grid.addWidget(self.rbut_GBN, 0, 1)
grid.addWidget(self.rbut_SR, 1, 1)
grid.addWidget(self.btn, 0, 2)
QtCore.QObject.connect(self.btn, QtCore.SIGNAL("clicked()"), self.Start)
QtCore.QObject.connect(self.rbut_GBN, QtCore.SIGNAL("clicked()"), self.ModeGBN)
QtCore.QObject.connect(self.rbut_SR, QtCore.SIGNAL("clicked()"), self.ModeSR)
grid.addWidget(self.title_wndSize, 2, 0)
grid.addWidget(self.sld_wndSize, 2, 1)
grid.addWidget(self.lcd_wndSize, 2, 2)
self.sld_wndSize.valueChanged.connect(self.lcd_wndSize.display)
self.sld_wndSize.valueChanged.connect(self.gui.setWndSize)
grid.addWidget(self.title_e2eDelay, 3, 0)
grid.addWidget(self.sld_e2eDelay, 3, 1)
grid.addWidget(self.lcd_e2eDelay, 3, 2)
self.sld_e2eDelay.valueChanged.connect(self.lcd_e2eDelay.display)
self.sld_e2eDelay.valueChanged.connect(self.gui.sete2eDelay)
grid.addWidget(self.title_timeout, 4, 0)
grid.addWidget(self.sld_timeout, 4, 1)
grid.addWidget(self.lcd_timeout, 4, 2)
self.sld_timeout.valueChanged.connect(self.lcd_timeout.display)
self.sld_timeout.valueChanged.connect(self.gui.settimeout)
grid.addWidget(self.title_pkt, 5, 0)
grid.addWidget(self.sld_pkt, 5, 1)
grid.addWidget(self.lcd_pkt, 5, 2)
self.sld_pkt.valueChanged.connect(self.lcd_pkt.display)
self.sld_pkt.valueChanged.connect(self.gui.setpkt)
grid.addWidget(self.title_scrollmode, 6, 0)
grid.addWidget(self.combx, 6, 1)
QtCore.QObject.connect(self.combx, QtCore.SIGNAL("activated(int)"), self.ModeScroll)
grid.addWidget(self.title_emt, 7, 0)
grid.addWidget(self.gui, 8, 0, 5, 3)
self.setLayout(grid)
self.showMaximized()
self.setWindowTitle('Selective Repeat / Go Back N')
self.show()
pass
def paintEvent(self, e):
qp = QtGui.QPainter()
qp.begin(self)
self.draw(qp)
qp.end()
pass
def draw(self, qp):
self.gui.draw(qp)
pass
def SendData(self):
pass
def Start(self):
if self.isStart == False:
self.gui.StartAction()
self.isStart = True
self.btn.setText('Stop')
pass
elif self.isStart == True:
self.gui.StopAction()
self.isStart = False
self.btn.setText('Start')
pass
pass
def ModeGBN(self):
self.gui.setMode(0)
pass
def ModeSR(self):
self.gui.setMode(1)
pass
def ModeScroll(self):
self.gui.setScrollMode(self.combx.currentIndex())
def keyPressEvent(self, e):
if e.key() == QtCore.Qt.Key_Escape:
self.close()
pass