本文整理汇总了Python中mainwindow.Ui_MainWindow.setupUi方法的典型用法代码示例。如果您正苦于以下问题:Python Ui_MainWindow.setupUi方法的具体用法?Python Ui_MainWindow.setupUi怎么用?Python Ui_MainWindow.setupUi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mainwindow.Ui_MainWindow
的用法示例。
在下文中一共展示了Ui_MainWindow.setupUi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Editor
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class Editor(QtGui.QMainWindow):
def __init__(self):
super(Editor, self).__init__()
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
self.show()
示例2: ControlMainWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class ControlMainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(ControlMainWindow, self).__init__(parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.exit_button.clicked.connect(self.CloseProgram)
@QtCore.Slot()
def CloseProgram(self):
sys.exit()
示例3: ScriptRunnerMainWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class ScriptRunnerMainWindow(QtGui.QMainWindow):
"""
This class initializes the main window for Script Runner
"""
def __init__(self):
"""
Set up the user interface from Designer.
"""
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
示例4: MyWindowClass
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class MyWindowClass(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.StartButton, QtCore.SIGNAL('clicked()'), self.doFitting)
QtCore.QObject.connect(self.ui.fileDialog, QtCore.SIGNAL('clicked()'), self.showFileInput)
def doFitting(self):
#t = np.arange(1.0, 5.0, 0.01)
#s = np.sin(2*np.pi*t)
#self.ui.xplot.canvas.ax.plot(t, s)
#self.ui.xplot.canvas.draw()
filename = self.ui.fileOutput.toPlainText()
self.ui.FitResultsSummary.setPlainText("These are fitting results")
self.ui.ErrorMessages.setPlainText("")
try:
data = file1.make_numpyarray(filename)
except:
self.ui.ErrorMessages.setPlainText("Something went wrong with fitting")
return None
fit1 = file1.fit_axis(data,0)
report = fit_report(fit1[2])
self.ui.FitResultsSummary.append(report)
# rotating by 90 degrees on the other axis doesn't work well yet
#t = np.arange(1.0, 5.0, 0.01)
#s = np.sin(2*np.pi*t)
#self.myplot = self.ui.yplot.canvas.ax.plot(t, s)
#self.rotated = ndimage.rotate(self.myplot,90)
#self.rotated.draw()
self.ui.BeamDisplay.canvas.ax.pcolorfast(data)
self.ui.BeamDisplay.canvas.draw()
def showFileInput(self):
fname = QtGui.QFileDialog.getOpenFileName(self, 'Open file',
'/home/Oleksiy/Desktop/PythonCode')
self.ui.fileOutput.setText(fname)
def keyPressEvent(self, e):
if e.key() == QtCore.Qt.Key_Escape:
self.close()
示例5: ClientWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class ClientWindow(QtGui.QMainWindow):
Image = 'kukeliku.png'
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.firstCard.setPixmap(QtGui.QPixmap(self.Image))
self.ui.firstCard = NewLabel(self)
self.ui.firstCard.move(0,0)
QtCore.QObject.connect(self.ui.firstCard, QtCore.SIGNAL("clicked()"), self.fix)
def fix(self):
self.ui.label.setText('Suck it')
示例6: MainWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.actionQuit.triggered.connect(QtCore.QCoreApplication.instance().quit)
self.ui.pkgList.itemClicked.connect(self._showPackageDetail)
self.ui.installedBtn.clicked.connect(self._showInstalled)
self.ui.availableBtn.clicked.connect(self._showAvailable)
self.ui.karmaWidget.hide()
#menu = QtGui.QMenu(self)
#menu.addAction("Description")
#menu.addAction("Comments")
#menu.addAction("Related packages")
#menu.addAction("Test cases")
#menu.activated.connect(self._showPage)
#self.ui.moreBtn.setMenu(menu)
def _showInstalled(self):
self.ui.availableBtn.setChecked(False)
def _showAvailable(self):
self.ui.installedBtn.setChecked(False)
def _switchView(self, n):
if not self.ui.pkgDetailWidget.isHidden():
if n == -10: # XXX weird values
self.ui.karmaWidget.show()
elif n == -11:
self.ui.karmaWidget.hide()
#def _showPage(self, n):
# TODO setCurrentIndex
# self.ui.descPage.hide()
# self.ui.commentPage.hide()
# self.ui.relatedPkgPage.hide()
# self.ui.testCasePage.hide()
# pages = {-5:self.ui.descPage, -6:self.ui.commentPage, -7:self.ui.relatedPkgPage, -8:self.ui.testCasePage} # XXX weird values
# pages[n].show() # XXX KeyError
def _showPackageDetail(self, item):
if self.ui.installedBtn.isChecked():
self.ui.karmaWidget.show()
else:
self.ui.karmaWidget.hide()
self._setData(item)
def _setData(self, item):
self.ui.pkgNameLabel.setText(item.text())
示例7: Main
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class Main(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.systemInformation()
def systemInformation(self):
subprocess.call('ps -ef > processlist.txt', shell=True)
with open('processlist.txt', 'r') as processList:
lines = processList.read().split('\n')
firstLine = lines[0].split()[::-1]
model = QtGui.QStandardItemModel(2,3,self)
increment = 0
first = True
for line in lines:
line = line.split()
fullCMD = ''
size = len(line)
incrementor = 7
while incrementor < size:
fullCMD = fullCMD + ' ' + line.pop(-1)
incrementor = incrementor + 1
line.append(fullCMD)
line = line[::-1]
columnIncrement = 0
for column in line:
if first:
model.setHorizontalHeaderItem(columnIncrement, QtGui.QStandardItem(column))
else:
model.setItem(increment, columnIncrement, QtGui.QStandardItem(column))
columnIncrement = columnIncrement + 1
if first:
first = False
else:
increment = increment + 1
self.ui.tableView.setModel(model)
示例8: webwindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class webwindow(QtWidgets.QMainWindow):
"""
Class that is derived from the mainWindow.ui file
which defines the browser window.
"""
def __init__(self, parent=None):
"""
Web browser constructor.
Sets the event handlers, as well as loading the UI
from the mainWindow.ui file.
"""
super(webwindow, self).__init__(parent)
self.ui = Ui_MainWindow() # define the UI
self.ui.setupUi(self)
homeurl = "http://www.google.com"
self.ui.lineEdit.setText(homeurl) # set the homepage
#load the home page after
self.ui.webView.setUrl(QtCore.QUrl(homeurl))
# tell the browser we want to handle the link clicking ourselves
self.ui.webView.page().setLinkDelegationPolicy(QtWebKitWidgets.QWebPage.DelegateAllLinks)
# hook up the url bar to RETURN KEYPRESS and GO button
self.ui.pushButton.clicked.connect(self.change_page)
self.ui.lineEdit.returnPressed.connect(self.change_page)
self.ui.webView.linkClicked.connect(self.clicked_link)
def change_page(self):
"""
Change page event handler (what happens when the html page changes)
"""
url = self.ui.lineEdit.text()
print(url)
self.ui.webView.setUrl(QtCore.QUrl(url))
def clicked_link(self, url):
"""
Overrides the original clickedlink handler
"""
self.ui.webView.setUrl(QtCore.QUrl(url))
self.ui.lineEdit.clear()
self.ui.lineEdit.insert(url.toString())
self.ui.lineEdit.home(False)
示例9: QTTest
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class QTTest(QMainWindow):
def __init__(self,pandaCallback):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
#fills widget with found models on dataset folder
self.fillPool()
self.setWidgetEvents()
# this basically creates an idle task
self.timer = QTimer(self)
self.connect( self.timer, SIGNAL("timeout()"), pandaCallback )
self.timer.start(0)
self.tp = TerrainPool(self.ui.terrainPool, self.ui.createTerrainButton, self.ui.modifyTerrainButton)
self.ui.actionPPL.triggered.connect(myEventHandler.togglePerPixelLighting)
self.ui.actionAmbientOcclusion.triggered.connect(myEventHandler.toggleAmbientOcclusion)
self.ui.actionToonShading.triggered.connect(myEventHandler.toggleToonShading)
def setWidgetEvents(self):
self.ui.eggPool.itemDoubleClicked.connect(self.sendNewModel)
self.ui.treeWidget.itemDoubleClicked.connect(self.toolTriggered)
'''
gui requests will be broadcasted
'''
def toolTriggered(self, item, column):
print "broadcasting: ", item.text(0)
messenger.send(item.text(0).__str__())
def fillPool(self):
self.ui.eggPool.clear()
files = Utilities.getFilesIn("dataset")
for e in files:
self.ui.eggPool.addItem(e)
def sendNewModel(self,item):
filepath = str(item.text()) #casting due to compatibility issues
messenger.send("addobject", [filepath])
示例10: ScriptRunnerMainWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class ScriptRunnerMainWindow(QtGui.QMainWindow):
"""
This class initializes the main window for Script Runner
"""
def __init__(self):
"""
Set up the user interface from Designer.
"""
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.settings = QtCore.QSettings()
def closeEvent(self, event):
self.settings.setValue("ScriptRunner/geometry", self.saveGeometry())
#settings.setValue("ScriptRunner/window_state", self.saveState())
#self.closeEvent(event)
def moveEvent(self, event):
self.settings.setValue("ScriptRunner/geometry", self.saveGeometry())
示例11: MyMainWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class MyMainWindow(QtGui.QMainWindow):
def __init__(self):
super().__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.pushButton_led.clicked.connect(self.run_led_demo)
self.ui.pushButton_buzzer.clicked.connect(self.run_buzzer_demo)
self.ui.pushButton_move.clicked.connect(self.run_move_demo)
def run_led_demo(self):
dialog = led_demo.LedDemo(self.ui.lineEdit_serialId.text())
dialog.exec()
def run_buzzer_demo(self):
dialog = buzzer_demo.BuzzerDemo(self.ui.lineEdit_serialId.text())
dialog.exec()
def run_move_demo(self):
dialog = move_demo.MoveDemo(self.ui.lineEdit_serialId.text())
dialog.exec()
示例12: QTranslator
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class QTranslator(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.thread = QtranslateThread()
self.thread.processDone.connect(self.showTranslatedText)
self.thread.isTranslating.connect(self.setStatus)
QtCore.QObject.connect(self.ui.actionTranslate, QtCore.SIGNAL("activated()"), self.Translate)
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL("activated()"), self.About)
def About(self):
global ABOUT_TEXT
QtGui.QMessageBox.information(self, 'About QTranslate',ABOUT_TEXT, QtGui.QMessageBox.Ok)
def Translate(self):
global BING_APP_ID
textOriginal = self.ui.txtOriginal.toPlainText()
if not textOriginal:
QtGui.QMessageBox.warning(self, 'Hey dude!','Please provide me some text to translate...', QtGui.QMessageBox.Ok)
return False
self.thread.appId = BING_APP_ID
self.thread.theText = textOriginal
self.thread.langFrom = str(self.ui.cbFrom.currentText())
self.thread.langTo = str(self.ui.cbTo.currentText())
self.thread.start()
def showTranslatedText(self, string):
self.ui.txtResult.setText(QtCore.QString(string))
def setStatus(self, status):
if status:
self.ui.lblStatus.setText('Loading...')
else:
self.ui.lblStatus.setText('Ready...')
示例13: main
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
from mainwindow import Ui_MainWindow
import subprocess
import os
import sys
useWindowOfMain = {}
def main():
print()
# refresh
# show window
if __name__ == "__main__":
infoCls = stockInfoCls()
infoCls.loadIni()
infoCls.stockInfoMaking()
print(useWindowOfMain)
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
ui.sendInfoClsInst(infoCls)
ui.do_refresh()
MainWindow.show()
sys.exit(app.exec_())
示例14: MainWindow
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class MainWindow(QtGui.QMainWindow):
def __init__(self, peaks, *args):
self.peaks = peaks
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.findPeakButton.clicked.connect(self.findPeaksCallback)
self.ui.fileButton.clicked.connect(self.loadFileCallback)
self.ui.saveButton.clicked.connect(self.savePeaksCallback)
def addPlot(self):
"""
Populate central widget with matplotlib canvas (and toolbar)
"""
self.fig = Figure(figsize=(600, 600), dpi=72, facecolor=(1,1,1), edgecolor=(0,0,0))
self.ax = self.fig.add_subplot(111)
self.canvas = FigureCanvasQTAgg(self.fig)
self.ui.canvasLayout.addWidget(self.canvas)
self.navi_toolbar = NavigationToolbar2QT(self.canvas, self)
self.ui.canvasLayout.addWidget(self.navi_toolbar)
def loadFileCallback(self):
"""
Qt "slot" called by "Load file..." button
"""
filename, _ = QtGui.QFileDialog.getOpenFileName(self, 'Open data file',)
if filename:
self.peaks.load(filename)
self.update()
self.ui.filenameLabel.setText("File: %s" % os.path.split(filename)[-1])
self.ui.statusBar.showMessage("File opened: %s" % os.path.split(filename)[-1])
def findPeaksCallback(self):
"""
Qt "slot" called by "Find peaks" button
"""
self.peaks.setMinMax( int(self.ui.minEntry.text()), int(self.ui.maxEntry.text()) )
self.ui.statusBar.showMessage("Calculating peaks")
self.peaks.findPeaks()
self.update()
self.ui.statusBar.showMessage("Calculation done")
def savePeaksCallback(self):
"""
Qt "slot" called by "Save to..." button
"""
filename, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save peaks to',)
if filename:
with open(filename, 'w') as f:
f.write(self.ui.peaksText.toPlainText())
self.ui.statusBar.showMessage("Peaks saved to: %s" % os.path.split(filename)[-1])
def update(self):
"""
Refresh plot widget (usually after loading a new file or asking peaks)
"""
self.ax.cla()
self.ax.plot(self.peaks.x, self.peaks.y)
if self.peaks.peaks:
self.ax.plot(self.peaks.peaks, [self.peaks.y[i] for i in self.peaks.peaks], 'ro')
self.ui.peaksText.setPlainText("\n".join(["%s; %s" % (p, v) for p, v in zip(self.peaks.peaks, [self.peaks.y[i] for i in self.peaks.peaks])]))
self.canvas.draw()
示例15: Main
# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import setupUi [as 别名]
class Main(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
# Setup the main window
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
# Set date to today
self.date = QtCore.QDate.currentDate()
self.ui.calendarWidget.setSelectedDate(self.date)
# Date format for SQLite
self.date_format = "yyyy-MM-dd"
# Used to remember the Students Id
self.student_dict = {}
# Create Attendance DB Connection Object
self.db = AttendDB()
# Create list models
self.availModel = QtGui.QStandardItemModel(0, 2)
self.attendModel = QtGui.QStandardItemModel(0, 2)
self.ui.availListView.setModel(self.availModel)
self.ui.attendListView.setModel(self.attendModel)
# Connect signals to handlers
self.connect(self.ui.addButton, QtCore.SIGNAL("clicked()"), \
self.on_add_clicked)
self.connect(self.ui.removeButton, QtCore.SIGNAL("clicked()"), \
self.on_remove_clicked)
self.connect(self.ui.calendarWidget, \
QtCore.SIGNAL("selectionChanged()"), \
self.on_date_change)
self.connect(self.ui.actionEdit_Students, \
QtCore.SIGNAL("triggered()"), \
self.on_edit_students_select)
# Update the lists to reflect the current date
self.update_views()
def on_edit_students_select(self):
"""Open the editing student window."""
edit_window = Students()
edit_window.exec_()
def on_date_change(self):
"""Update views when the date is changed."""
self.date = self.ui.calendarWidget.selectedDate()
self.update_views()
def update_views(self):
"""Refresh the students available and attending for the given date."""
# Get correct date format
self.date_string = self.date.toString(self.date_format)
# Clear Models
self.availModel.clear()
self.attendModel.clear()
for student in self.db.get_attendance_for_date(self.date_string):
if student[1] != None and student[1] != '':
name = str(student[1])
else:
name = str(student[2]) + ' ' + str(student[3])
# Add student to the attended list view
itemlist = [QtGui.QStandardItem(name), \
QtGui.QStandardItem(str(student[0]))]
self.attendModel.appendRow(itemlist)
for student in self.db.get_students():
# Don't add them to available list if they attended given date
if student[1] != None and student[1] != '':
name = str(student[1])
else:
name = str(student[2]) + ' ' + str(student[3])
# Add student to available list view
itemlist = [QtGui.QStandardItem(name), \
QtGui.QStandardItem(str(student[0]))]
if self.attendModel.findItems(name) == []:
self.availModel.appendRow(itemlist)
self.availModel.sort(0)
self.attendModel.sort(0)
def on_add_clicked(self):
"""Move student from available to attended list."""
selected_indexes = self.ui.availListView.selectedIndexes()
for index in selected_indexes:
row = self.availModel.itemFromIndex(index).row()
#rowList = self.availModel.takeRow(row)
student = self.availModel.item(row, 0).text()
sid = self.availModel.item(row, 1).text()
try:
#.........这里部分代码省略.........