Example #1
0
    def __init__(self):
        super(HmiLogViewer, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.aboutDialog = MyAboutDialog(self)

        self.model = None
        self.parserConfig = {'headers': None, 'cols': None}
        self.projectId = ""

        # Menu entries actions
        QtCore.QObject.connect(self.ui.actionOpen,
                               QtCore.SIGNAL("triggered()"), self.openFile)
        QtCore.QObject.connect(self.ui.actionAddFile,
                               QtCore.SIGNAL("triggered()"),
                               lambda: self.openFile(True))
        QtCore.QObject.connect(self.ui.actionClose,
                               QtCore.SIGNAL("triggered()"), self.closeFile)
        QtCore.QObject.connect(self.ui.actionSaveAs,
                               QtCore.SIGNAL("triggered()"), self.saveFile)
        QtCore.QObject.connect(self.ui.actionImportConfigFile,
                               QtCore.SIGNAL("triggered()"),
                               self.importConfigFile)
        QtCore.QObject.connect(self.ui.actionAbout,
                               QtCore.SIGNAL("triggered()"),
                               self.aboutDialog.open)
        # Tool buttons actions
        QtCore.QObject.connect(self.ui.toolBtnOpen, QtCore.SIGNAL("clicked()"),
                               self.openFile)
        QtCore.QObject.connect(self.ui.toolBtnAppend,
                               QtCore.SIGNAL("clicked()"),
                               lambda: self.openFile(True))
        QtCore.QObject.connect(self.ui.toolBtnSave, QtCore.SIGNAL("clicked()"),
                               self.saveFile)
Example #2
0
 def __init__(self):
     super(SerialProgramLoader, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.loaderFrameLayout = QVBoxLayout(self.ui.loaderFrame)
     self.ui.loaderFrameLayout.setMargin(0)
     self.ui.loaderFrame.setLayout(self.ui.loaderFrameLayout)
     self.ui.loader = Loader(self)
     self.ui.loaderFrameLayout.addWidget(self.ui.loader)
Example #3
0
def main():
    # This is only used for Pycharm to close the application when you only want to build the dependencies
    if len(sys.argv) > 1 and sys.argv[1] == '--build-only':
        print("Build successful!")
        return

    # Create the application object
    app = QApplication(sys.argv)

    # Create the main window
    main_window = QMainWindow()

    # Set icon
    icon = QtGui.QIcon()
    icon.addPixmap(QtGui.QPixmap(":/Icons/logo.ico"), QtGui.QIcon.Normal,
                   QtGui.QIcon.Off)
    main_window.setWindowIcon(icon)

    # Load the custom UI settings from QtDesigner into the main window
    ui = Ui_MainWindow()
    ui.setupUi(main_window)

    main_window.statusBar().hide()

    # Set the version number
    version_str = ".".join([str(x) for x in version])
    ui.versionLabel.setText(f"Remote Play Anything v{version_str}" +
                            ("" if len(sys.argv) <= 1 else
                             f", with args: {' '.join(sys.argv[1:])}"))

    # Initialize the list of games
    game_list = GameList(ui)

    # Add click events to all the buttons
    ui.startGameButton.clicked.connect(game_list.start_game)
    ui.addGameButton.clicked.connect(game_list.add_game)
    ui.editGameButton.clicked.connect(game_list.edit_game)
    ui.removeGameButton.clicked.connect(game_list.remove_game)
    ui.moveGameUpButton.clicked.connect(game_list.move_game_up)
    ui.moveGameDownButton.clicked.connect(game_list.move_game_down)
    ui.gamesList.clicked.connect(game_list.select_game)

    # Hide move button for now
    ui.moveGameUpButton.hide()
    ui.moveGameDownButton.hide()

    # Set the size of the window to fixed
    main_window.statusBar().setSizeGripEnabled(False)
    main_window.setFixedSize(main_window.size())

    # Finally show the window
    main_window.show()

    # Exit the app after closing the window
    sys.exit(app.exec_())
Example #4
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)

        self.products = Products(os.path.join(get_data_dir(), "products.csv"))
        self.cart = Cart(self.products)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.buildButtonGroups()
        self.buildPages()

        self.connectAll()

        logging.setStatusbar(self.ui.statusBar)

        self.setPage(list(self.pages.keys())[1])
        self.setCategoryPage(0)
    def __init__(self):
        super(OpcDataTrender, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.aboutDialog = MyAboutDialog(self)

        self.samples = []

        try:
            self.opc = OPCHandler()
        except OpenOPC.OPCError, error_msg:
            self.opc = None
            QtGui.QMessageBox.question(
                self.ui.centralwidget, u"OPC Error",
                u"Failed to open a connection to OPC server :\n%s" % error_msg,
                QtGui.QMessageBox.Ok)
            exit()
Example #6
0
 def login(self):
     login_url = "http://localhost:8080/api/login"
     username = self.lineEdit.text()
     password = self.lineEdit_2.text()
     data = {"username": username, "password": password}
     response = requests.post(login_url, data=data)
     if "{" in response.text and "}" in response.text:
         print("DSADS")
         self.json = response.json()
         if self.json["bad_credentials"]:
             print("bad_credentials")
         else:
             print("Logged in")
             with open("token", "w+") as file:
                 file.write(self.json["token"])
             self.close()
             Ui_MainWindow().login()
     else:
         print("Something unexpected happened")
Example #7
0
    def __init__(self, parent=None):
        super(MainWindows, self).__init__(parent)
        self.Ui = Ui_MainWindow()
        self.Ui.setupUi(self)
        self.setWindowIcon(QtGui.QIcon('./logo.ico'))
        self.port_list = []
        self.load()
        self.threads = []
        #列表框点击切换
        self.Ui.port_file.activated[str].connect(self.change_port_file)
        #引入文件
        self.Ui.pushButton_file.clicked.connect(self.open_file)
        #开始扫描
        self.Ui.pushButton_start.clicked.connect(self.start_scanner)

        #设置漏洞扫描表格属性  列宽度
        # self.Ui.tableWidget_result.setColumnWidth(0, 55 )
        self.Ui.tableWidget_result.setColumnWidth(0, 211)
        self.Ui.tableWidget_result.setColumnWidth(1, 100)
        self.Ui.tableWidget_result.setColumnWidth(2, 300)
Example #8
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.progress = 0
        self.collections = None
        self.workingDirectory = None
        self.workingFiles = None
        self.workingFileType = None  # Should be ( archive | dir )
        self.workingFileIndex = 0
        self.scene = QGraphicsScene()
        self.ui.progressBar.hide()
        self.ui.graphicsView = PhotoViewer(self)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.ui.graphicsView.sizePolicy().hasHeightForWidth())
        self.ui.graphicsView.setSizePolicy(sizePolicy)
        self.ui.graphicsView.setObjectName("graphicsView")
        self.ui.gridLayout.addWidget(self.ui.graphicsView, 1, 0, 1, 1)

        self.main()
Example #9
0
def replay_event(main, setReplay):
    def wrapped():
        setReplay(True)
        main.close()

    return wrapped


if __name__ == '__main__':
    replay = False
    running = False
    sock = socket(AF_INET, SOCK_DGRAM)

    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    main = Ui_MainWindow()
    main.setupUi(MainWindow)

    buttons = {
        "a": main.button_a,
        "b": main.button_b,
        "c": main.button_c,
        "d": main.button_d,
        "e": main.button_e,
        "f": main.button_f,
        "g": main.button_g,
        "h": main.button_h
    }

    main.label.setText("Wait...")
Example #10
0
    if text == 'True':
        ui_main.bt_start.setText('2.全部开始')
    else:
        ui_main.ed_log.append(text)


if __name__ == '__main__':

    dataPath = 'datas/set.pkl'
    # 自定义一个信号
    ms = log_sg = Myignals()
    # 绑定日志更新的信号
    ms.log_add.connect(log_add)
    #实例化抢购对象
    hw = PanicBuying()
    t = []  #线程容器
    driver = []  #浏览器容器
    start = False  #全局暂停和开始的开关
    close_all = False
    app = QApplication(sys.argv)
    window_main = QMainWindow()  # 主界面
    ui_main = Ui_MainWindow()  # 实例化
    ui_main.setupUi(window_main)  # 运行里面的代码
    init_window_main()  # 初始化和对接代码功能
    with open('datas\main.qss', 'r') as f:
        style = f.read()
    window_main.setStyleSheet(style)

    window_main.show()
    sys.exit(app.exec_())
Example #11
0
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSignal
import requests
from ui.login import Ui_LoginWindow
from ui.main import Ui_MainWindow

if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = QMainWindow()
    main_ui = Ui_MainWindow()
    main_ui.login()
    sys.exit(app.exec_())