本文整理汇总了Python中ui.Ui_MainWindow类的典型用法代码示例。如果您正苦于以下问题:Python Ui_MainWindow类的具体用法?Python Ui_MainWindow怎么用?Python Ui_MainWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ui_MainWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StartQT4
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.clidict = Param_To_Cli()
self.ui.interface_choice.addItems(netifaces.interfaces())
QtCore.QObject.connect(
self.ui.start, QtCore.SIGNAL("clicked()"), self.start_sniffer)
# QtCore.QObject.connect(
# self.ui.interface_choice, QtCore.SIGNAL("activated(const QString&)"), self.get_interface)
#
# QtCore.QObject.connect(
# self.ui.mode_choice, QtCore.SIGNAL("activated(const QString&)"), self.get_mode)
# QtCore.QObject.connect(
# self.ui.lineEdit, QtCore.SIGNAL("editingFinished()"), self.get_filter)
def start_sniffer(self):
self.clidict.interface = str(self.ui.interface_choice.currentText())
self.clidict.mode = str(self.ui.mode_choice.currentText())
self.clidict.filter = str(self.ui.lineEdit.text())
log.debug(self.clidict.interface + '' +
self.clidict.mode + '' + self.clidict.filter)
sniffer_prepare(self.clidict)
self.sniff_queue = Queue()
sniffer = SnifferProcess(
self.sniff_queue, iface=self.clidict.interface)
sniffer.start()
while True:
item = self.sniff_queue.get()
self.ui.packet_list.addItem(item.summary())
QtGui.QApplication.processEvents()
示例2: main
class main(QtGui.QMainWindow):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.file_dialog=QtGui.QFileDialog()
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
self.fn=None
QtCore.QObject.connect(self.ui.action_Save,QtCore.SIGNAL("triggered()"),self.save_file)
QtCore.QObject.connect(self.ui.actionNew,QtCore.SIGNAL("triggered()"),self.new_file)
QtCore.QObject.connect(self.ui.actionOpen,QtCore.SIGNAL("triggered()"),self.open_file)
QtCore.QObject.connect(self.ui.action_Saveas,QtCore.SIGNAL("triggered()"),self.saveas_file)
QtCore.QObject.connect(self.ui.actionPrint,QtCore.SIGNAL("triggered()"),self.save_file)
QtCore.QObject.connect(self.ui.actionPrint_Preview,QtCore.SIGNAL("triggered()"),self.save_file)
QtCore.QObject.connect(self.ui.action_quit,QtCore.SIGNAL("triggered()"),self.quit)
def save_file(self):
if self.fn!=None:
fileobj=open(self.fn,'w')
fileobj.write(self.ui.textEdit.toPlainText())
fileobj.close()
else:
filename=self.file_dialog.getSaveFileName(self,u"保存文件")
try:
fileobj=open(filename,'w')
fileobj.write(self.ui.textEdit.toPlainText())
self.fn=filename
fileobj.close()
except Exception ,e:
pass
示例3: Gui
class Gui(QtGui.QMainWindow):
def __init__(self,capture, getFrame, parent = None):
QtGui.QWidget.__init__(self,parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.video = Video(capture, getFrame)
self._timer = QtCore.QTimer(self)
self._timer.timeout.connect(self.play)
self._timer.start(27)
self.update()
def play(self):
try:
self.video.captureNextFrame()
self.ui.videoFrame.setPixmap(self.video.convertFrame())
self.ui.videoFrame.setScaledContents(True)
gethistogram(self.ui.axes,tuple(self.video.histogram.values()),tuple(self.video.histogram.keys()))
# l = [random.randint(0, 10) for i in range(4)]
# self.ui.axes.plot(self.video.histogram.values(), 'r')
self.ui.canvas.draw()
if(len(self.video.labels)!=0):
self.ui.label1.setText(self.video.name)
# self.ui.label2.setText(self.video.labels[1])
# self.ui.label3.setText(self.video.labels[2])
# self.ui.label4.setText(self.video.labels[3])
# self.ui.label5.setText(self.video.labels[4])
except TypeError as e:
print("No Frame", e)
示例4: mainForm
class mainForm(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.pannel = []
# 기본 패널
self.pannel.append(tab_widget(addTab, self))
self.func_insert_tab(u'새로운 탭')
self.pannel.append(tab_widget(communicationPannel, self))
self.func_insert_tab(u'DataPort')
QtCore.QObject.connect(self.pannel[0].pannel.ui.clb, QtCore.SIGNAL("clicked()"), self.AddTab)
def AddTab(self):
current_index = len(self.ui.tabWidget)
self.pannel.append(tab_widget(communicationPannel, self))
self.func_insert_tab(u'DataPort')
# 프로그램을 닫으려 할때
def closeEvent(self, event):
reply = QtGui.QMessageBox.warning(self,
u'프로그램 종료', u"진행중인 모든 데이터 송·수신을 중지합니다.\n프로그램을 종료하시겠습니까?",
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
event.accept()
elif reply == QtGui.QMessageBox.No:
event.ignore()
def func_insert_tab(self, tab_name):
"""
* 탭이 추가되면 항상 '새탭추가탭' 앞 쪽에 위치
* 추가된 탭이 활성화
"""
current_index = len(self.ui.tabWidget)
self.ui.tabWidget.insertTab(current_index - 1, self.pannel[current_index], unicode(tab_name))
self.ui.tabWidget.setCurrentIndex(current_index - 1)
def slot_close_tab(self, tab_index):
print tab_index
if 1 == self.ui.tabWidget.count():
# '새탭 추가탭'을 닫으려 할 경우
return
reply = QtGui.QMessageBox.warning(
self,u'탭 닫기', u"저장하지 않은 작업 내용은 잃게됩니다.\n탭을 닫으시겠습니까?",
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
self.pannel.pop(tab_index + 1)
self.ui.tabWidget.removeTab(tab_index)
elif reply == QtGui.QMessageBox.No: pass
示例5: MyForm
class MyForm(QtGui.QMainWindow):
def showMessage(self,string):
self.ui.messageTextbox.setText(string)
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
#here start
downloader.fileLabel = self.ui.fileLabel
downloader.nowSizeLabel = self.ui.nowSizeLabel
downloader.totalSizeLabel = self.ui.totalSizeLabel
downloader.messageTextbox = self.ui.messageTextbox
#pass para
self.connect(self.ui.aButton,QtCore.SIGNAL('clicked()'),self.aButton_clicked)
self.connect(self.ui.bButton,QtCore.SIGNAL('clicked()'),self.bButton_clicked)
self.connect(self.ui.aAfternoonButton,QtCore.SIGNAL('clicked()'),self.aAfternoonButton_clicked)
self.connect(self.ui.bAfternoonButton,QtCore.SIGNAL('clicked()'),self.bAfternoonButton_clicked)
self.connect(self.ui.downloadPercentButton,QtCore.SIGNAL('clicked()'),self.downloadPercentButton_clicked)
self.connect(self.ui.nextButton,QtCore.SIGNAL('clicked()'),self.nextButton_clicked)
#event
def aButton_clicked(self):
thread.start_new_thread(downloader.main,(1,True))
def bButton_clicked(self):
thread.start_new_thread(downloader.main,(0,True))
def aAfternoonButton_clicked(self):
thread.start_new_thread(downloader.main,(1,False))
def bAfternoonButton_clicked(self):
thread.start_new_thread(downloader.main,(0,False))
def nextButton_clicked(self):
downloader.goNext = True
def downloadPercentButton_clicked(self):
downloader.refreshPercent()
示例6: Gui
class Gui(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.video = Video(cv2.VideoCapture(0))
self._timer = QtCore.QTimer(self)
self._timer.timeout.connect(self.play)
self._timer.start(27)
self.update()
def play(self):
'''
capture frame and display
'''
try:
self.video.capture_next_frame()
self.ui.videoFrame.setPixmap(
self.video.convert_frame())
self.ui.videoFrame.setScaledContents(True)
except TypeError:
print "No frame"
def mousePressEvent(self, event):
'''
click mouse and put point on opencv window
'''
self.video.add_point(QtCore.QPoint(event.pos()),
self.ui.videoFrame.geometry())
示例7: MyForm
class MyForm(QtGui.QMainWindow):
def __init__(self, logAnalyser, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self, len(logAnalyser.files))
self.logAnalyser = logAnalyser
self.threadLogAnalyser = ThreadedLogAnalyser(self, self.logAnalyser)
self.connect(self.threadLogAnalyser, QtCore.SIGNAL("appendLogs"), self.ui.appendLogs)
def main(self):
self.threadLogAnalyser.start()
示例8: __init__
def __init__(self, pod):
super().__init__()
MainWindow.console = ConsoleWidget(
namespace = {
'pod': pod,
'win': self,
},
text='You can use this window to enter Python commands.')
MainWindow.console.setWindowTitle('Python interaction')
self._ui = Ui_MainWindow()
self._ui.setupUi(self)
self._ui.startButton.clicked.connect(pod.begin)
self._ui.submitButton.clicked.connect(self.submitCommand)
pod.connected.connect(self.enable)
self._ui.actionSettings.triggered.connect(self.networkDialog)
self._ui.actionReconnect.triggered.connect(pod.begin)
self._ui.actionConsoleOpen.triggered.connect(self.openConsole)
pod.add_listener('*', self.appendNetworkLog)
pod.add_listener('v', self.updateVelocityLCD)
pod.add_listener('v', self._ui.velocityPlot.datum)
pod.add_listener('h', self.updateHeightLCD)
pod.add_listener('h', self._ui.heightPlot.datum)
pod.add_listener('d', self.updateDistanceLCD)
pod.add_listener('d', self._ui.distancePlot.datum)
self.command.connect(pod)
self.networkUpdate.connect(pod.try_connect)
self.timer = QTimer()
self.timer.timeout.connect(self._ui.velocityPlot.update)
self.timer.timeout.connect(self._ui.heightPlot.update)
self.timer.timeout.connect(self._ui.distancePlot.update)
self.timer.start(_1s)
示例9: __init__
def __init__(self, settings, application=None):
'''
UI Object that draws the main window.
Listens to the following settings:
- delay:
'''
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self._renderwidgets = [
RenderWidget(self),
RenderWidget(self),
RenderWidget(self),
RenderWidget(self),
]
self.update()
self.application = application
self.settings = settings
self.settings.settingChanged.connect(self.settingChanged)
self.ui.delay.setText(str(settings.getSetting("delay")))
self._loadScreens(self.settings.getSetting("layouts")[self.settings.getSetting("selectedlayout")]["screen"])
self._bindings = {}
self._windowstate = None
self._loadBindings(settings.getSetting('keybinding'))
示例10: __init__
def __init__(self):
"""
Initializes the DecrypterWindow
"""
super(DecrypterWindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
# connect event handlers
self.ui.calibrateButton.clicked.connect(self.calibrateButtonHandler)
self.ui.importButton.clicked.connect(self.importButtonHandler)
self.ui.exportButton.clicked.connect(self.exportButtonHandler)
for c in string.lowercase:
self.ui.edit[c].textEdited.connect(self.editModifiedHandler)
# disable unavailable functionality
self.ui.importButton.setDisabled(True)
self.ui.exportButton.setDisabled(True)
for c in string.lowercase:
self.ui.edit[c].setDisabled(True)
self.decrypter = None
self.show()
self.setFixedSize(self.size())
示例11: __init__
def __init__(self):
super(Main, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.load_data()
self.connect_signals()
self.show()
示例12: __init__
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.clidict = Param_To_Cli()
self.ui.interface_choice.addItems(netifaces.interfaces())
QtCore.QObject.connect(
self.ui.start, QtCore.SIGNAL("clicked()"), self.start_sniffer)
示例13: __init__
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.start_button.clicked.connect(self.start_master)
self.ui.connect_button.clicked.connect(self.start_client)
self.ui.close_button.clicked.connect(self.close)
self.CONNECTION_PORT = 1111
self.update()
示例14: __init__
def __init__(self,capture, getFrame, parent = None):
QtGui.QWidget.__init__(self,parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.video = Video(capture, getFrame)
self._timer = QtCore.QTimer(self)
self._timer.timeout.connect(self.play)
self._timer.start(27)
self.update()
示例15: StartQT4
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.clidict = Param_To_Cli()
self.ui.interface_choice.addItems(netifaces.interfaces())
QtCore.QObject.connect(
self.ui.start, QtCore.SIGNAL("clicked()"), self.start_sniffer)
QtCore.QObject.connect(
self.ui.action_stop, QtCore.SIGNAL("triggered()"), self.stop_sniffer)
#self.ui.packet_list.setHorizontalHeaderLabels(['时间','源地址','目的地址','内容'])
# QtCore.QObject.connect(
# self.ui.interface_choice, QtCore.SIGNAL("activated(const QString&)"), self.get_interface)
#
# QtCore.QObject.connect(
# self.ui.mode_choice, QtCore.SIGNAL("activated(const QString&)"), self.get_mode)
# QtCore.QObject.connect(
# self.ui.lineEdit, QtCore.SIGNAL("editingFinished()"), self.get_filter)
def start_sniffer(self):
self.clidict.interface = str(self.ui.interface_choice.currentText())
self.clidict.mode = str(self.ui.mode_choice.currentText())
self.clidict.filter = str(self.ui.lineEdit.text())
log.debug(self.clidict.interface + '' + self.clidict.mode + '' + self.clidict.filter)
sniffer_prepare(self.clidict)
self.sniff_queue = multiprocessing.JoinableQueue()
self.sniffer = SnifferProcess(self.sniff_queue, iface=str(self.clidict.interface))
self.sniffer.start()
self.displaythreading = DisplayPacket(self.sniff_queue, self.ui.packet_list)
self.displaythreading.start()
self.ui.action_stop.setEnabled(True)
def stop_sniffer(self):
self.sniffer.terminate()
self.sniff_queue.close()
while True:
if self.sniff_queue.empty():
break
self.displaythreading.terminate()