Ejemplo n.º 1
0
def main_window(qtbot, mocker):
    user = mocker.create_autospec(User)
    user.char_for_offer_symbol = 'N'
    user.business_symbol = 'X'
    main_window = MainWindow(user)
    qtbot.addWidget(main_window)
    return main_window
Ejemplo n.º 2
0
def main():
    logging.info("pyOffer version %s started at %s", version, datetime.now())
    locale_set = locale.setlocale(locale.LC_ALL, '')
    logging.info("System locale: %s", locale_set)
    app = QApplication(sys.argv)
    app.setOrganizationName("KonserwSoft")
    app.setApplicationName("pyOffer")

    lang = QLocale.system().name()[0:2]
    logging.info("Loading translation for: %s", lang)
    translator = QTranslator()
    if translator.load(f"translations/{lang}"):
        app.installTranslator(translator)
        logging.info("Loaded translations from: %s", f"translations/{lang}")
    else:
        logging.warning("Failed to load translations from: %s",
                        f"translations/{lang}")

    settings = QSettings()
    settings.beginGroup("database")
    host_name = settings.value("host_name", "127.0.0.1")
    port = int(settings.value("port", "5432"))
    database_name = settings.value("database_name", "koferta_test")
    user_name = settings.value("user_name", "postgres")
    password = settings.value("password", "docker")
    settings.endGroup()
    try:
        logging.info("DB host name: %s", host_name)
        logging.info("DB port: %s", port)
        logging.info("DB database name: %s", database_name)
        logging.info("DB user name: %s", user_name)
        database.connect(host_name, database_name, user_name, password, port)
    except RuntimeError as e:
        QMessageBox.critical(
            None, app.tr("Database connection failed"),
            app.tr(f"Driver error: {e.args[1]}\nDatabase error: {e.args[2]}"))
        return str(e)
    user_dialog = UserSelectionDialog.make()
    if user_dialog.exec_() == QDialog.Accepted:
        logging.debug("User dialog accepted")
        user = User.from_sql_record(user_dialog.chosen_user_record)
        logging.info("Chosen user: %s", user)
        main_window = MainWindow(user)
        main_window.show()
        return app.exec_()
    logging.info("User hasn't been chosen - exiting")
    return 0
def test_visual_pandas_cropper():
    plot_config_dict = {
        "x_axis_col": "timestamp",
        "sub_plt1_data": ["q0", "q1", "q2", "q3"],
        "sub_plt2_data": ["u0", "u1", "u2", "u3", "u4", "u5", "u6", "u7"]}
    data_df = pd.read_csv("resources/test.csv", index_col=0)

    app = QtWidgets.QApplication(sys.argv)

    w = MainWindow(data_df, plot_config_dict)
    app.exec_()
    print("Selected dataframe:")
    print(w.cropped_data_df)
    return
Ejemplo n.º 4
0
def main(createDB=False):
    print("{1} Starting bikechurch-signin v{0}".format(
        ".".join([str(x) for x in version]), datetime.datetime.now()))

    CheckVersion("wx", "2.8")
    CheckVersion("MySQLdb", "1.2.2")
    CheckVersion("sqlalchemy", "0.6")

    if createDB:
        CreateTablesFromScratch()
        ReadMembersFromCSV("members.csv", "succeeded.csv", "failed.csv")

    ResetController()

    app = wx.App()
    MainWindow()
    app.MainLoop()
Ejemplo n.º 5
0
import sys
from PyQt5.QtWidgets import QApplication
from src.main_window import MainWindow

app = QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-
import ctypes
import sys

from PyQt5 import QtWidgets

from src.main_window import MainWindow
from src.read_qrc.read_file import read_qss
from static import image_rc

_author_ = 'luwt'
_date_ = '2020/10/9 15:44'


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    # 获取当前屏幕分辨率
    desktop = QtWidgets.QApplication.desktop()
    screen_rect = desktop.screenGeometry()
    app.setStyleSheet(read_qss())
    ui = MainWindow(screen_rect)
    # 声明AppUserModelID,否则windows认为这是python子程序,无法使用自定义任务栏图标
    ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("ssh")
    ui.show()
    app.exec_()
    sys.exit()
Ejemplo n.º 7
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec())
Ejemplo n.º 8
0
#!/usr/bin/python3
from PyQt5.QtWidgets import QApplication
import sys

from src.main_window import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)
    main = MainWindow()
    main.show()

    sys.exit(app.exec_())
def select_visual_data(data_df, plot_config_dict):
    app = QtWidgets.QApplication(sys.argv)
    w = MainWindow(data_df, plot_config_dict)
    app.exec_()
    return w.cropped_data_df
Ejemplo n.º 10
0
#!/usr/bin/env python
""" Start the UI app by calling the main window """

# Author: Roberto Buelvas

import wx

from src.main_window import MainWindow

if __name__ == "__main__":
    app = wx.App()
    mw = MainWindow(None)
    mw.Show()
    app.MainLoop()
 def run(self):
     self.current_widget = MainWindow()
     sys.exit(self.__app.exec_())
Ejemplo n.º 12
0
__author__ = 'Tofu Gang'

from sys import argv, exit
from PyQt5.QtWidgets import QApplication
from src.main_window import MainWindow

################################################################################

if __name__ == "__main__":
    app = QApplication(argv)
    window = MainWindow()
    window.show()
    exit(app.exec_())

################################################################################
Ejemplo n.º 13
0
def active_window(db):
    user = User.from_sql_record(get_user_record(1))
    window = MainWindow(user)
    window.new_offer()
    return window
Ejemplo n.º 14
0
from PyQt5.QtWidgets import QApplication
from src.main_window import MainWindow
import sys

if __name__ == '__main__':
    app = QApplication(sys.argv)
    screen = MainWindow()
    screen.showFullScreen()
    sys.exit(app.exec_())