def initUI(self): screen = QtGui.QDesktopWidget().screenGeometry() self.setGeometry(screen.width() / 20 * 16, screen.height() / 20 * 1, 280, 30) # we can resize the widget. https://blog.csdn.net/y673582465/article/details/73603265 sizeGrip = QtGui.QSizeGrip(self) self.setWindowTitle('AndroidTools') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.SubWindow) quitAction = QtGui.QAction(_fromUtf8("退出"), self) quitAction.connect(quitAction, QtCore.SIGNAL('triggered()'), QtGui.qApp.quit) self.popMenu = QtGui.QMenu() self.popMenu.addAction(quitAction) self.mainLayout = QtGui.QVBoxLayout() firstHBox = QtGui.QHBoxLayout() self.weatherlabel = QtGui.QLabel(_fromUtf8("天气")) self.tipsLabel = QtGui.QLabel(_fromUtf8("桌面提示")) self.moreBtn = QtGui.QPushButton() self.weatherlabel.setPalette(QtFontUtil().setFontColor2Palette(QtCore.Qt.black)) self.tipsLabel.setPalette(QtFontUtil().setFontColor2Palette(QtCore.Qt.red)) self.weatherlabel.connect(self.weatherlabel, QtCore.SIGNAL('weatherUpdateSignal(QString)'), self.showWeather) self.tipsLabel.connect(self.tipsLabel, QtCore.SIGNAL('tipsChangeSignal(QString)'), self.showTips) self.moreBtn.connect(self.moreBtn, QtCore.SIGNAL('clicked()'), self.clickMoreBtn) self.setMoreBtnIcon() firstHBox.addWidget(self.weatherlabel) firstHBox.addWidget(self.moreBtn) self.mainLayout.addLayout(firstHBox) self.mainLayout.addWidget(self.tipsLabel) self.mainLayout.addStretch(1) self.setLayout(self.mainLayout) tranColor = QtGui.QColor(0xDE, 0xDE, 0xDE) self.setTransparency(tranColor) self.queryTipsMethod()
def __init__(self, parent): QtGui.QMainWindow.__init__(self, parent) SkinHelper().setStyle(self, ':/qss/titlebar_style.qss') self.setFixedHeight(30) self.mPIconLabel = QLabel() self.mPTitleLabel = QLabel() self.mPMinimizeBtn = QPushButton() self.mPMaximizeBtn = QPushButton() self.mPCloseBtn = QPushButton() self.mPIconLabel.setFixedSize(20, 20) # !!必须要设置这一项,表示大小随内容缩放,配合等宽高setFixedSize,控件随图片按照等比缩放内容 self.mPIconLabel.setScaledContents(True) self.mPTitleLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.mPTitleLabel.setFont(QtFontUtil().getFont(u'微软雅黑', 14, True)) self.mPMinimizeBtn.setFixedSize(20, 20) self.mPMaximizeBtn.setFixedSize(20, 20) self.mPCloseBtn.setFixedSize(20, 20) self.mPTitleLabel.setObjectName(u'titleLabel') self.mPMinimizeBtn.setObjectName(u'minimizeBtn') self.mPMaximizeBtn.setObjectName(u'maximizeBtn') self.mPCloseBtn.setObjectName(u'closeBtn') # self.mPMinimizeBtn.setPixmap(QtGui.QPixmap(':/darkqss/dark_img/close-hover.png')) # self.mPMaximizeBtn.setPixmap(QtGui.QPixmap(':/darkqss/dark_img/close-pressed.png')) # self.mPCloseBtn.setPixmap(QtGui.QPixmap(':/darkqss/dark_img/close.png')) # !!必须要设置这一项,表示大小随内容缩放,配合等宽高setFixedSize,控件随图片按照等比缩放内容 # self.mPMinimizeBtn.setScaledContents(True) # self.mPMaximizeBtn.setScaledContents(True) # self.mPCloseBtn.setScaledContents(True) hBoxLayout = QHBoxLayout() hBoxLayout.addWidget(self.mPIconLabel) hBoxLayout.addSpacing(5) hBoxLayout.addWidget(self.mPTitleLabel) hBoxLayout.addWidget(self.mPMinimizeBtn) hBoxLayout.addWidget(self.mPMaximizeBtn) hBoxLayout.addWidget(self.mPCloseBtn) # 控件之间的间距 hBoxLayout.addSpacing(0) # 控件与窗体之间的间距 hBoxLayout.setContentsMargins(5, 0, 5, 0) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) # 这里使用的信号槽方式有3种,以后可以参考下,理一下思路。这里都是实验ok的。 self.connect(self.mPMinimizeBtn, QtCore.SIGNAL('clicked()'), self.parent(), QtCore.SLOT('showMinimized()')) self.connect(self.mPMaximizeBtn, QtCore.SIGNAL('clicked()'), self.maximizeBtnClick) self.connect(self.mPCloseBtn, QtCore.SIGNAL('clicked()'), QtGui.qApp, QtCore.SLOT('quit()')) self.widget = QtGui.QWidget() self.widget.setMouseTracking(True) self.widget.setLayout(hBoxLayout) self.setCentralWidget(self.widget)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) mainLayout = QtGui.QVBoxLayout() # show log self.logGroupBox = QtGui.QGroupBox(_fromUtf8("日志")) self.logHBox = QtGui.QHBoxLayout() self.logTextEdit = QtGui.QTextEdit() self.logTextEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.logTextEdit.setFont(QtFontUtil().getFont('Monospace', 12)) self.logHBox.addWidget(self.logTextEdit) self.logGroupBox.setLayout(self.logHBox) mainLayout.addWidget(self.logGroupBox) self.setLayout(mainLayout)
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setWindowTitle(u'桌面提醒信息') self.centralwidget = QWidget() self.setCentralWidget(self.centralwidget) self.resize(350, 100) self.tipsDao = TipsDao() self.tipsList = [] mainLayout = QtGui.QVBoxLayout() mainLayout.setAlignment(QtCore.Qt.AlignTop) mainLayout.setContentsMargins(5, 10, 5, 2) operHBox = QtGui.QHBoxLayout() tipsForm = QtGui.QFormLayout() self.tipsTypeComboBox = QtGui.QComboBox() self.tipsDescEdit = QtGui.QLineEdit() self.tipsListEdit = QtGui.QTextEdit() self.tipsDescEdit.setPlaceholderText(_fromUtf8("输入提醒事项")) # tipsLayout = QtGui.QHBoxLayout() # tipsLayout.addWidget(self.tipsTypeComboBox, QtCore.Qt.AlignVCenter) # tipsLayout.addWidget(self.tipsDescEdit) # tipsForm.addRow(tipsLayout) tipsForm.addRow(self.tipsTypeComboBox, self.tipsDescEdit) self.tipsTypeComboBox.setMinimumHeight(25) self.tipsDescEdit.setMinimumHeight(25) self.addBtn = QtGui.QPushButton(_fromUtf8("添加")) self.deleteBtn = QtGui.QPushButton(_fromUtf8("删除")) self.queryBtn = QtGui.QPushButton(_fromUtf8("查询")) self.addBtn.connect(self.addBtn, QtCore.SIGNAL('clicked()'), self.doAddMethod) self.deleteBtn.connect(self.deleteBtn, QtCore.SIGNAL('clicked()'), self.doDeleteMethod) self.queryBtn.connect(self.queryBtn, QtCore.SIGNAL('clicked()'), self.doQueryMethod) self.tipLabel = QtGui.QLabel() self.tipLabel.setFont(QtFontUtil().getFont('Monospace', 12)) self.tipLabel.setContentsMargins(5, 0, 5, 5) self.setTipsType() operHBox.addWidget(self.addBtn, 1) operHBox.addWidget(self.deleteBtn, 1) operHBox.addWidget(self.queryBtn, 1) mainLayout.addLayout(tipsForm) mainLayout.addWidget(self.tipsListEdit) mainLayout.addSpacing(5) mainLayout.addLayout(operHBox) mainLayout.addStretch(1) mainLayout.addWidget(self.tipLabel) self.centralwidget.setLayout(mainLayout)
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setWindowTitle(u'adb指令') self.centralwidget = QWidget() self.setCentralWidget(self.centralwidget) self.resize(350, 200) self.adbDao = AdbDao() mainLayout = QtGui.QVBoxLayout() mainLayout.setAlignment(QtCore.Qt.AlignTop) mainLayout.setContentsMargins(5, 10, 5, 2) operHBox = QtGui.QHBoxLayout() adbCmdForm = QtGui.QFormLayout() adbCmdNameLabel = QtGui.QLabel(_fromUtf8("adb名称:")) adbCmdLabel = QtGui.QLabel(_fromUtf8("adb命令:")) adbCmdDescLabel = QtGui.QLabel(_fromUtf8("adb描述:")) self.adbCmdNameEdit = QtGui.QLineEdit() self.adbCmdEdit = QtGui.QLineEdit() self.adbCmdDescEdit = QtGui.QLineEdit() self.adbCmdNameEdit.setFixedHeight(25) self.adbCmdEdit.setFixedHeight(25) self.adbCmdDescEdit.setFixedHeight(25) adbCmdForm.addRow(adbCmdNameLabel, self.adbCmdNameEdit) adbCmdForm.addRow(adbCmdLabel, self.adbCmdEdit) adbCmdForm.addRow(adbCmdDescLabel, self.adbCmdDescEdit) self.addBtn = QtGui.QPushButton(_fromUtf8("添加")) self.addBtn.setMinimumWidth(150) self.addBtn.connect(self.addBtn, QtCore.SIGNAL('clicked()'), self.doAddAdbMethod) self.deleteBtn = QtGui.QPushButton(_fromUtf8("删除")) self.deleteBtn.setMinimumWidth(150) self.deleteBtn.connect(self.deleteBtn, QtCore.SIGNAL('clicked()'), self.doDeleteAdbMethod) self.tipLabel = QtGui.QLabel() self.tipLabel.setFont(QtFontUtil().getFont('Monospace', 12)) self.tipLabel.setContentsMargins(5, 0, 5, 5) operHBox.addStretch() operHBox.addWidget(self.addBtn) operHBox.addSpacing(20) operHBox.addWidget(self.deleteBtn) operHBox.addStretch() mainLayout.addLayout(adbCmdForm) mainLayout.addSpacing(30) mainLayout.addLayout(operHBox) mainLayout.addStretch(1) mainLayout.addWidget(self.tipLabel) self.centralwidget.setLayout(mainLayout)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.orderDao = WorkOrderDao() mainLayout = QtGui.QVBoxLayout() workOrderForm = QtGui.QFormLayout() operateHBox = QtGui.QHBoxLayout() orderNumLabel = QtGui.QLabel(_fromUtf8("工单号:")) orderTitleLabel = QtGui.QLabel(_fromUtf8("工单标题:")) orderReasonLabel = QtGui.QLabel(_fromUtf8("问题回复:")) self.orderNumEdit = QtGui.QLineEdit() self.orderTitleEdit = QtGui.QLineEdit() self.orderReasonEdit = QtGui.QTextEdit() orderNumLabel.setMinimumHeight(25) orderTitleLabel.setMinimumHeight(25) orderReasonLabel.setMinimumHeight(25) self.orderNumEdit.setMinimumHeight(25) self.orderTitleEdit.setMinimumHeight(25) orderAddBtn = QtGui.QPushButton(_fromUtf8("增加")) orderDeleteBtn = QtGui.QPushButton(_fromUtf8("删除")) orderQueryWeekBtn = QtGui.QPushButton(_fromUtf8("导出本周")) orderQueryAllBtn = QtGui.QPushButton(_fromUtf8("导出所有")) orderAddBtn.setFixedSize(100, 30) orderDeleteBtn.setFixedSize(100, 30) orderQueryWeekBtn.setFixedSize(100, 30) orderQueryAllBtn.setFixedSize(100, 30) orderAddBtn.connect(orderAddBtn, QtCore.SIGNAL('clicked()'), self.orderAddMethod) orderDeleteBtn.connect(orderDeleteBtn, QtCore.SIGNAL('clicked()'), self.orderDeleteMethod) orderQueryWeekBtn.connect(orderQueryWeekBtn, QtCore.SIGNAL('clicked()'), self.exportWeekData) orderQueryAllBtn.connect(orderQueryAllBtn, QtCore.SIGNAL('clicked()'), self.exportAllData) self.orderNumEdit.connect(self.orderNumEdit, QtCore.SIGNAL('textChanged(QString)'), self.changeOrderNumInput) self.tipLabel = QtGui.QLabel() self.tipLabel.setFont(QtFontUtil().getFont('Monospace', 12)) self.tipLabel.setContentsMargins(5, 0, 5, 5) self.tipLabel.connect(self.tipLabel, QtCore.SIGNAL('tipsChangeSignal(QString)'), self.setTips) workOrderForm.addRow(orderNumLabel, self.orderNumEdit) workOrderForm.addRow(orderTitleLabel, self.orderTitleEdit) workOrderForm.addRow(orderReasonLabel, self.orderReasonEdit) # 将表单最后一个文本框设置为可垂直拉伸 QtGui.QSizePolicy policy = self.orderReasonEdit.sizePolicy() policy.setVerticalStretch(1) self.orderReasonEdit.setSizePolicy(policy) operateHBox.addWidget(self.tipLabel) operateHBox.addStretch(1) operateHBox.addWidget(orderAddBtn) operateHBox.addWidget(orderDeleteBtn) operateHBox.addWidget(orderQueryWeekBtn) operateHBox.addWidget(orderQueryAllBtn) mainLayout.addLayout(workOrderForm) mainLayout.addSpacing(5) mainLayout.addLayout(operateHBox) self.setLayout(mainLayout)
def __init__(self, parent=None): QMainWindow.__init__(self, parent) SkinHelper().setStyle(self, ':/qss/titlebar_style.qss') self.centralwidget = QWidget() self.setCentralWidget(self.centralwidget) self.resize(1024, 668) self.setWindowFlags(QtCore.Qt.X11BypassWindowManagerHint | QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) self.mainHBoxLayout = QtGui.QHBoxLayout() self.leftVBoxLayout = QtGui.QVBoxLayout() self.rightVBoxLayout = QtGui.QVBoxLayout() self.loginFormLayout = QtGui.QFormLayout() self.loginFormLayout.setObjectName(u'loginForm') self.palette = QtGui.QPalette() self.palette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.red) # -------------- left vBox ---------------------- # QPixmap self.labelImage = QtGui.QLabel() self.logo = QtGui.QPixmap(':/darkqss/dark_img/maikailun.jpg') self.labelImage.setPixmap(self.logo) # self.labelImage.setScaledContents(True) self.leftVBoxLayout.addWidget(self.labelImage) self.leftVBoxLayout.setAlignment(QtCore.Qt.AlignCenter) # -------------- left vBox ---------------------- # -------------- right vBox ---------------------- # mail # self.mailHBoxLayout = QtGui.QHBoxLayout() self.mailLabel = QtGui.QLabel("UserTel:") # self.mailLabel.setFixedWidth(82) self.mailLabel.setFont(QtFontUtil().getFont('微软雅黑', 14, True)) self.mailLabel.setPalette(self.palette) self.mailEditLabel = QtGui.QLineEdit() self.mailEditLabel.setObjectName(u'loginEdit') self.mailEditLabel.setPlaceholderText(u'请输入手机号码') self.mailEditLabel.setFont(QtFontUtil().getFont('微软雅黑', 14, True)) self.mailEditLabel.setPalette(self.palette) self.mailEditLabel.setTextMargins(10, 0, 10, 0) # self.mailHBoxLayout.addStretch(1) # self.mailHBoxLayout.addWidget(self.mailLabel) # self.mailHBoxLayout.addWidget(self.mailEditLabel) # self.mailHBoxLayout.addStretch(1) # password # self.pwdHBoxLayout = QtGui.QHBoxLayout() self.pwdLabel = QtGui.QLabel("Password:") # self.pwdLabel.setFixedWidth(80) self.pwdLabel.setFont(QtFontUtil().getFont('微软雅黑', 14, True)) self.pwdLabel.setPalette(self.palette) self.pwdEditLabel = QtGui.QLineEdit() self.pwdEditLabel.setObjectName(u'loginEdit') self.pwdEditLabel.setEchoMode(QtGui.QLineEdit.Password) self.pwdEditLabel.setPlaceholderText(u'请输入手机动态码') self.pwdEditLabel.setFont(QtFontUtil().getFont('微软雅黑', 14, True)) self.pwdEditLabel.setPalette(self.palette) self.pwdEditLabel.setTextMargins(10, 0, 10, 0) # self.pwdHBoxLayout.addStretch(1) # self.pwdHBoxLayout.addWidget(self.pwdLabel) # self.pwdHBoxLayout.addWidget(self.pwdEditLabel) # self.pwdHBoxLayout.addStretch(1) # formLayout 属性设置 # Label 的对齐方式 self.loginFormLayout.setLabelAlignment(QtCore.Qt.AlignLeft) # form 的对齐方式 self.loginFormLayout.setFormAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom) # 表单一行的内容显示方式 self.loginFormLayout.setRowWrapPolicy(QtGui.QFormLayout.DontWrapRows) # field 域延伸方式 self.loginFormLayout.setFieldGrowthPolicy( QtGui.QFormLayout.FieldsStayAtSizeHint) self.loginFormLayout.addRow(self.mailLabel, self.mailEditLabel) self.loginFormLayout.addRow(self.pwdLabel, self.pwdEditLabel) self.loginFormLayout.setAlignment(QtCore.Qt.AlignRight) # Login self.loginHBoxLayout = QtGui.QHBoxLayout() self.loginBtn = QtGui.QPushButton() self.loginBtn.setObjectName(u'loginBtn') self.loginBtn.setText(u'登录') self.loginBtn.setFont(QtFontUtil().getFont('微软雅黑', 14, True)) self.loginBtn.connect(self.loginBtn, QtCore.SIGNAL('clicked()'), self.loginByThread) # self.loginHBoxLayout.addSpacing(75) self.loginHBoxLayout.addWidget(self.loginBtn) self.loginHBoxLayout.setAlignment(QtCore.Qt.AlignCenter) self.rightVBoxLayout.addLayout(self.loginFormLayout, 2) self.rightVBoxLayout.addSpacing(-30) self.rightVBoxLayout.addLayout(self.loginHBoxLayout, 1) self.rightVBoxLayout.addStretch(1) # self.rightVBoxLayout.setAlignment(QtCore.Qt.AlignCenter) # -------------- right vBox ---------------------- # self.vBoxLayout.addStretch(1) # self.vBoxLayout.addLayout(self.mailHBoxLayout) # self.vBoxLayout.addLayout(self.pwdHBoxLayout) # self.vBoxLayout.addStretch(1) # self.vBoxLayout.addLayout(self.loginHBoxLayout) # self.vBoxLayout.addStretch(1) # self.vBoxLayout.setContentsMargins(40, 40, 40, 40) # self.centralwidget.setLayout(self.vBoxLayout) self.mainHBoxLayout.addLayout(self.leftVBoxLayout, 1) self.mainHBoxLayout.addLayout(self.rightVBoxLayout, 1) self.centralwidget.setLayout(self.mainHBoxLayout) # fix setPlaceholderText in first editLabel not show problem # @see {https://stackoverflow.com/questions/24274318/placeholder-text-not-showing-pyside-pyqt} self.setFocus()
def setupUi(self, mainWindow, localServer, argv=None): self.mainwindow = mainWindow # 解决多终端问题 http://www.oschina.net/code/snippet_54100_629 self.localServer = localServer # 获取当前脚本所在的目录 # self.sysArg0 = argv[0] mainWindow.setObjectName(_fromUtf8("MainWindow")) # MainWindow.resize(800, 600) self.centralwidget = QtGui.QWidget(mainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.statusBar = QtGui.QStatusBar(mainWindow) self.menubar = QtGui.QMenuBar() menubarFont = self.menubar.font() menubarFont.setPointSize(12) # menubarFont.setFamily("宋体") # menubarFont.setFamily("Monospace") menubarFont.setFamily("Microsoft YaHei") self.menubar.setFont(menubarFont) adminLogin = self.menubar.addMenu(u' &登录') managerUser = self.menubar.addMenu(u'&用户管理') managerCate = self.menubar.addMenu(u'&分类管理') managerGoods = self.menubar.addMenu(u'&商品管理') managerOrder = self.menubar.addMenu(u'&订单管理') managerBanner = self.menubar.addMenu(u'&公告管理') managerOther = self.menubar.addMenu(u' &其他') # 设置固定大小,注意添加菜单后,需要增加对应的width,此处是为了能够控制窗口大小,以便鼠标拖动 self.menubar.setFixedWidth(550) # =============== action ====================== # managerUser action userQueryAction = QtGui.QAction(u'用户查询', mainWindow) userQueryAction.setStatusTip(_fromUtf8('可根据手机号查询用户')) # managerOther action otherExpressAction = QtGui.QAction(u'快递查询', mainWindow) otherExpressAction.setIcon( QtGui.QIcon(":/dardqss/dark_img/branch_open-on.png")) otherExpressAction.setStatusTip(_fromUtf8('可根据快递单号或者订单号查询')) # otherExpressAction.connect(otherExpressAction, QtCore.SIGNAL('triggered()'), self.) otherBillAction = QtGui.QAction(u'账单统计', mainWindow) otherBillAction.setStatusTip(_fromUtf8('账单查询')) # =============== action ====================== # =============== 控件 ====================== self.ShowMsgEdit = QtGui.QTextEdit() self.ShowMsgEdit.setFont(QtFontUtil().getFont('Monospace', 10)) self.ShowMsgEdit.setText(u'showMsgEdit') self.cateTreeWidget = QtGui.QTreeWidget() self.goodsListWidget = QtGui.QListWidget() # =============== 控件 ====================== managerUser.addAction(userQueryAction) managerOther.addAction(otherExpressAction) managerOther.addAction(otherBillAction) # 添加到 mainWindow # mainWindow.setMenuBar(self.menubar) mainWindow.setStatusBar(self.statusBar) # vBoxLayout 和 hBoxLayout 的选择依据是:根据2个控件的排列方向,上下排(vBoxLayout)还是左右排(hBoxLayout) vBoxLayout = QtGui.QVBoxLayout() hBboxLayout = QtGui.QHBoxLayout() hCateGoodsBoxLayout = QtGui.QHBoxLayout() # 控件之间的间距 hCateGoodsBoxLayout.setSpacing(10) # 控件与窗体之间的间距 hCateGoodsBoxLayout.setContentsMargins(10, 10, 10, 0) # 获取大小策略 cateTreeSizePolicy = self.cateTreeWidget.sizePolicy() goodsListSizePolicy = self.goodsListWidget.sizePolicy() # 缩放策略 cateTreeSizePolicy.setHorizontalPolicy(QSizePolicy.Maximum) goodsListSizePolicy.setHorizontalPolicy(QSizePolicy.Expanding) # 缩放因子 cateTreeSizePolicy.setHorizontalStretch(1) goodsListSizePolicy.setHorizontalStretch(2) self.cateTreeWidget.setSizePolicy(cateTreeSizePolicy) self.goodsListWidget.setSizePolicy(goodsListSizePolicy) hCateGoodsBoxLayout.addWidget(self.cateTreeWidget) hCateGoodsBoxLayout.addWidget(self.goodsListWidget) hBboxLayout.addLayout(hCateGoodsBoxLayout) # hBboxLayout.addWidget(self.ShowMsgEdit) titleBar = TitleBar(self.mainwindow) titleBar.setTitle(u'已登录') titleBar.setLogo(':/darkqss/dark_img/undock.png') titleBar.connect(titleBar, QtCore.SIGNAL('maximaxProSignal'), self.maximizedOrNormal) vBoxLayout.addWidget(titleBar) # vBoxLayout.addWidget(self.menubar) vBoxLayout.addLayout(hBboxLayout) vBoxLayout.setAlignment(Qt.AlignTop) vBoxLayout.setContentsMargins(0, 0, 0, 0) self.centralwidget.setLayout(vBoxLayout) # 处理右键打开,或者直接拖文件到桌面图标启动。 # argv 参数大于1,说明有其他文件路径。第0位是当前应用程序,第1位则是我们需要处理的文件路径 # 注意这里,是需要处理sys.argv 的编码问题的,方法是使用 WinCommandEnCoding.py 处理 # if len(argv) > 1: # filePath = argv[1] # if SupportFiles.hasSupportFile(filePath): # self.setLogTxt(_translate('', filePath, None)) # 监听新到来的连接(新的终端被打开) self.localServer.connect(localServer, QtCore.SIGNAL('newConnection()'), self.newLocalSocketConnection) mainWindow.setCentralWidget(self.centralwidget)