Пример #1
0
 def run(self):
     app_ctx = ApplicationContext()
     window = Window()
     app_ctx.app.setWindowIcon(QIcon(window.icon_path))
     rgb_finder = RGBFinder(window)
     rgb_finder.run()
     return app_ctx.app.exec_()
Пример #2
0
def run():
    application_context = ApplicationContext()

    service_locator.set_injector(
        Injector([InjectionModule(application_context)]))
    app: QApplication = application_context.app
    app.setApplicationDisplayName("NASM Debugger")
    app.setOrganizationName("personal")
    app.setOrganizationDomain("com.michael.bradley.nasm-debugger")
    app.setQuitOnLastWindowClosed(True)
    # noinspection PyUnresolvedReferences
    app.lastWindowClosed.connect(save_settings)

    logger = service_locator.logger()
    logger.info("Welcome to NASM Debugger! The application is starting up...")
    logger.info(
        f"Log files are written to {service_locator.config().logs_directory}")
    logger.info(
        f"User settings are written to {service_locator.settings().user.file_path()}"
    )

    window = service_locator.get_service(NASMDebuggerWindow)
    window.show()

    exit_code = application_context.app.exec()
    sys.exit(exit_code)
Пример #3
0
    def __init__(self, wheres_the_fck_receipt: api_interface.WheresTheFckReceipt, parent=None):
        QWidget.__init__(self, parent=None)
        self.wheres_the_fck_receipt = wheres_the_fck_receipt

        # tab widget
        self.tab_widget = QTabWidget()
        self.tab_widget.addTab(SettingsWidget(wheres_the_fck_receipt), "Settings")
        self.tab_widget.addTab(Indexer(wheres_the_fck_receipt), "Indexer")
        self.tab_widget.addTab(SearcherWidget(wheres_the_fck_receipt), "Searcher")
        self.tab_widget.currentChanged.connect(self.tab_changed)

        # get settings
        settings = QSettings('WheresTheFckReceipt', 'WheresTheFckReceipt')
        active_tab = settings.value("active_tab", 0)
        self.tab_widget.setCurrentIndex(active_tab)

        # build window title
        app_context = ApplicationContext()
        version = app_context.build_settings['version']
        app_name = app_context.build_settings['app_name']
        window_title = app_name + " v" + version

        # build main window
        self.setWindowTitle(window_title)
        self.setCentralWidget(self.tab_widget)
        self.resize(800, 600)
Пример #4
0
	def render(self):
		self.setObjectName('bg-dark-gradient')

		# Jumbotron

		self.jumbotron_bg = QLabel(self)
		self.jumbotron_bg.setPixmap(
			QPixmap(self.state['APPCTX'].get_resource('img/bg.jpg'))
		)
		self.jumbotron_bg.setScaledContents(True)
		self.jumbotron_span = QLabel("""
			<p style="color:white; font-weight:800; font-size:65pt; line-height:55%">PeakFinder</p>
			<br>
			<p style="color:white; font-weight:100; font-size:16pt;">
				Herramienta para la detección y análisis de contracciones en tiempo real.
			</p>
		""", self.jumbotron_bg)
		self.jumbotron_span.setAlignment(Qt.AlignCenter)
		self.jumbotron_span.setWordWrap(True)
		self.jumbotron_span.setObjectName('jumbotron_span')


		# Formulario
		self.email = input(self, Rtype="email")
		

		# Footer
		self.footer = QLabel(self)
		self.footer.setPixmap(QPixmap(ApplicationContext().get_resource('img/waves.png')))
		self.footer.setScaledContents(True)
Пример #5
0
def main():
    global appctxt
    appctxt = ApplicationContext()

    # TODO: load_window

    # loading
    english.parse()
    hindi.parse()
    main_window = MainWindow()

    # TODO: connect to click event on load_window
    main_window.show()

    # there seems to be some time lag when devanagari characters have to be rendered
    # in hindi_box tab page for the first time.
    # this prevents awkward lag when first hindi page switch is performed.
    main_window.tabs.setCurrentWidget(main_window.hindi_box)
    ri = 'рдЛ'
    main_window.hindi_box.appendHtml(ri)
    main_window.hindi_box.clear()
    main_window.tabs.setCurrentWidget(main_window.english_box)

    exit_code = appctxt.app.exec_()
    sys.exit(exit_code)  # clean exit
Пример #6
0
class KeithleyApp(BaseMicroscopeApp):

    name = "OECT_Control"
    appctxt = ApplicationContext()
    ui_filename = appctxt.get_resource('base_microscope_app_mdi.ui')

    def setup(self):
        # self.appctxt = ApplicationContext()

        from keithley2400_sourcemeter_hc import Keithley2400SourceMeterComponent

        self.k1 = self.add_hardware(
            Keithley2400SourceMeterComponent(self,
                                             name='keithley2400_sourcemeter1'))
        self.k1.settings['port'] = 'GPIB0::22'

        self.k2 = self.add_hardware(
            Keithley2400SourceMeterComponent(self,
                                             name='keithley2400_sourcemeter2'))
        self.k2.settings['port'] = 'GPIB0::24'

        from output_curve_measure import OutputCurveMeasure
        self.add_measurement(OutputCurveMeasure(self))
        from transfer_curve_measure import TransferCurveMeasure
        self.add_measurement(TransferCurveMeasure(self))

        from test_device_measure import TestDeviceMeasure
        self.add_measurement(TestDeviceMeasure(self))
        from transient_step_response_measure import TransientStepResponseMeasure
        self.add_measurement(TransientStepResponseMeasure(self))
Пример #7
0
    def createAndDeleteButtonClicked(self):
        appctx = ApplicationContext()

        alert = QMessageBox()
        alert.setIcon(QMessageBox.Question)
        alert.setText("All information present "
                      "on the current spreadsheet "
                      "will be lost. "
                      "Are you sure you wish to continue?")
        alert.setWindowTitle("Spreadsheet Reset Confirmation")
        alert.setWindowIcon(QIcon(appctx.get_resource("sheets.ico")))
        alert.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        alert.setDefaultButton(QMessageBox.No)
        reply = alert.exec_()

        if reply == alert.Yes:
            spreadsheet_hdl = SpreadsheetHandler()
            spreadsheet_hdl.delete_spreadsheet()
            spreadsheet_hdl.create_spreadsheet()

            self.resetCategoriesComboBox()

            alert = QMessageBox()
            alert.setWindowTitle("Spreadsheet Reset")
            alert.setWindowIcon(QIcon(appctx.get_resource("sheets.ico")))
            alert.setText("A new spreadsheet was created!")
            alert.exec_()
Пример #8
0
    def addCategoryButtonClicked(self):
        spreadsheet_hdl = SpreadsheetHandler()
        appctx = ApplicationContext()

        new_category = self.addCategoryLine.text()

        categories = spreadsheet_hdl.read_categories()

        if new_category in categories:
            alert = QMessageBox()
            alert.setWindowTitle("Category Adding")
            alert.setWindowIcon(QIcon(appctx.get_resource("sheets.ico")))
            alert.setText("The category " + new_category + " already exists.")
            alert.exec_()
            return

        spreadsheet_hdl.add_category(new_category)

        self.resetCategoriesComboBox()

        alert = QMessageBox()
        alert.setWindowTitle("Category Adding")
        alert.setWindowIcon(QIcon(appctx.get_resource("sheets.ico")))
        alert.setText("The category " + new_category + " was succesfully added!")
        alert.exec_()
Пример #9
0
    def __init__(self, main_logger, ssh_pass):
        self.main_logger = main_logger
        #define settings from config
        self.remote_list = [("127.0.0.1", 6969)]
        self.local_list = [("127.0.0.1", 6969)]
        self.creds_pass = ssh_pass
        self.ssh_config_file = open(
            ApplicationContext().get_resource("ssh_config.json"))
        self.ssh_config = json.load(self.ssh_config_file)
        self.ssh_hostname = self.ssh_config['hostname']
        self.ssh_port = self.ssh_config['port']
        self.ssh_user = self.ssh_config['username']
        print(self.ssh_config)

        #create loggger
        SSHTF_create_logger(loglevel="DEBUG", logger=main_logger)

        #establish sshtunnel server
        self.server = SSHTunnelForwarder(
            self.ssh_hostname,
            ssh_port=self.ssh_port,
            ssh_username=self.ssh_user,
            ssh_password=self.creds_pass,
            remote_bind_addresses=self.remote_list,
            local_bind_addresses=self.local_list)
Пример #10
0
    def submitIncomeButtonClicked(self):
        spreadsheet_hdl = SpreadsheetHandler()
        appctx = ApplicationContext()

        data = [
            ["=MONTH(\""+self.incomesDateEdit.date().toString("MM/dd/yyyy")+"\")",
             self.incomesDateEdit.date().toString("MM/dd/yyyy"),
             str(self.incomesDoubleSpinBox.value()),
             self.incomesSpecificationLine.text(),
             self.incomesObservationLine.text()
             ]
        ]

        for index in range(len(data[0])):
            if data[0][index] == "":
                data[0][index] = "-"

        spreadsheet_hdl.append_data(data, range="Incomes")
        spreadsheet_hdl.income_sort_by_date()

        alert = QMessageBox()
        alert.setWindowTitle("Income Submitted")
        alert.setWindowIcon(QIcon(appctx.get_resource("submit.ico")))
        alert.setText("The income was submitted!")
        alert.exec_()
Пример #11
0
    def submitExpenseButtonClicked(self):
        spreadsheet_hdl = SpreadsheetHandler()
        appctx = ApplicationContext()

        if self.nonRecurringExpenseBox.checkState() == 2:
            recurring_status = "Non-Recurring"
        else:
            recurring_status = "Recurring"

        data = [
            ["=MONTH(\""+self.expenseDateEdit.date().toString("MM/dd/yyyy")+"\")",
             self.expenseDateEdit.date().toString("MM/dd/yyyy"),
             str(self.expenseDoubleSpinBox.value()),
             self.expenseCategoriesComboBox.currentText(),
             self.expenseSpecificationLine.text(),
             recurring_status,
             self.expenseObservationLine.text()
             ]
        ]

        for index in range(len(data[0])):
            if data[0][index] == "":
                data[0][index] = "-"

        spreadsheet_hdl.append_data(data, range="Expenses")
        spreadsheet_hdl.expenses_sort_by_date()

        alert = QMessageBox()
        alert.setWindowTitle("Expense Submitted")
        alert.setWindowIcon(QIcon(appctx.get_resource("submit.ico")))
        alert.setText("The expense was submitted!")
        alert.exec_()
Пример #12
0
    def __init__(
        self, 
        output_dir: str, 
        backup_experiment_start_index: int, 
        experiment_baseline_start_index: int, 
        experiment_baseline_end_index: int, 
        test_pulse_plot_start: float,
        test_pulse_plot_end: float, 
        test_pulse_baseline_samples: int,
        thumbnail_step: int,
        initial_nwb_path: Optional[str],
        initial_stimulus_ontology_path: Optional[str],
        initial_qc_criteria_path: Optional[str]
    ):
        self.app_cntxt = ApplicationContext()

        sweep_plot_config = SweepPlotConfig(
            test_pulse_plot_start,
            test_pulse_plot_end,
            test_pulse_baseline_samples,
            backup_experiment_start_index,
            experiment_baseline_start_index, 
            experiment_baseline_end_index,
            thumbnail_step
        )

        # initialize components
        self.main_window = MainWindow()
        self.pre_fx_controller: PreFxController = PreFxController()
        self.pre_fx_data: PreFxData = PreFxData()
        self.fx_data: FxData = FxData()
        self.sweep_page = SweepPage(sweep_plot_config)
        self.feature_page = CellFeaturePage()
        self.plot_page = PlotPage()
        self.status_bar = self.main_window.statusBar()
        # set cmdline params
        self.pre_fx_controller.set_output_path(output_dir)
        
        # connect components
        self.pre_fx_controller.connect(self.pre_fx_data, self.fx_data)
        self.sweep_page.connect(self.pre_fx_data)
        self.main_window.insert_tabs(self.sweep_page, self.feature_page, self.plot_page)
        self.main_window.create_main_menu_bar(self.pre_fx_controller)
        self.fx_data.connect(self.pre_fx_data)
        self.feature_page.connect(self.fx_data)

        self.main_window.setup_status_bar(self.pre_fx_data, self.fx_data)

        # initialize default data
        self.pre_fx_data.set_default_stimulus_ontology()
        self.pre_fx_data.set_default_qc_criteria()

        # The user can request that specific data be loaded on start
        if initial_stimulus_ontology_path is not None:
            self.pre_fx_controller.selected_stimulus_ontology_path.emit(initial_stimulus_ontology_path)
        if initial_qc_criteria_path is not None:
            self.pre_fx_controller.selected_qc_criteria_path.emit(initial_qc_criteria_path)
        if initial_nwb_path is not None:
            self.pre_fx_controller.selected_data_set_path.emit(initial_nwb_path)
Пример #13
0
 def __init__(self, design_name):
     self.appctxt = ApplicationContext()
     design_path = self.appctxt.get_resource(design_name)
     Form, Window = uic.loadUiType(design_path)
     self.window = Window()
     self.ui = Form()
     self.ui.setupUi(self.window)
     self.file_dialog = QFileDialog()
Пример #14
0
 def __init__(self, url):
     super().__init__()
     generate_qr_code(url)
     self.appctxt = ApplicationContext()
     stylesheet = self.appctxt.get_resource('styles.qss')
     self.appctxt.app.setStyleSheet(open(stylesheet).read())
     self.v_window = VideoWindow()
     self.s_window = SearchWindow()
Пример #15
0
def main():
    appctxt = ApplicationContext()
    template_path = appctxt.get_resource("pattern.png")
    appctxt.app.setStyle("Fusion")
    window = MainWindow(template_path)
    window.show()
    exit_code = appctxt.app.exec_()
    sys.exit(exit_code)
    return exit_code
Пример #16
0
def main():
    appctxt = ApplicationContext()
    w = QtWidgets.QWidget()
    with open('config.json') as json_file:
        config = json.load(json_file)
    tray = SystemTrayIcon(config, w)
    update_tray(config, tray)
    tray.show()
    exit_code = appctxt.app.exec_()
    sys.exit(exit_code)
Пример #17
0
def main():
    appctxt = ApplicationContext()
    # stylesheet = appctxt.get_resource('styles.qss')
    # appctxt.app.setStyleSheet(open(stylesheet).read())
    appctxt.app.setStyle('Fusion')
    window = MainWindow()
    window.show()
    exit_code = appctxt.app.exec_()
    sys.exit(exit_code)
    return exit_code
def main():
    print("Entering fbs")
    appctxt = ApplicationContext()       # 1. Instantiate ApplicationContext
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow, appctxt)
    MainWindow.show()
    exit_code = appctxt.app.exec_()      # 2. Invoke appctxt.app.exec_()
    sys.exit(exit_code)
    os.system('fbs run')
Пример #19
0
def window():
    appctxt = ApplicationContext()
    app = QApplication(sys.argv)
    win = MainWindow()
    win.show()
    timer = QTimer()
    timer.timeout.connect(win.mainWidget.display_new_messages)
    timer.start(1000)
    app.exec_()
    exit_code = appctxt.app.exec_()
Пример #20
0
    def __init__(self, ui_main, main_logger, ssh_pass):
        #set imports as part of self
        self.uimain = ui_main
        self.ssh_tunnel = magmaGS.magmaGS(main_logger, ssh_pass)

        #read config
        self.actions_config_file = open(
            ApplicationContext().get_resource("actions_config.json"))
        self.actions_config = json.load(self.actions_config_file)
        print(self.actions_config)
        self.hosts_file = python_hosts.Hosts()
Пример #21
0
 def preloadInsults(self):
     insultsFiles = [
         "pirate", "scifi", "scottish", "medieval", "shakespeare"
     ]
     insults = {}
     for file in insultsFiles:
         insultsFilePath = ApplicationContext().get_resource(f"{file}.txt")
         with open(insultsFilePath) as insultsFile:
             insultsList = insultsFile.read().split("\n")
             insults[file] = insultsList
     self.insults = insults
Пример #22
0
    def __init__(self, parent=None):
        self.appctxt = ApplicationContext()
        super(MsUiDesign, self).__init__(parent)
        self.setWindowTitle("MikroScript")
        self.setStyleSheet(COLOR_BG)
        self.resize(1128, 768)
        self.setMinimumSize(1128, 768)
        self.setWindowIcon(QIcon(self.appctxt.get_resource("favicon.png")))

        # Updated by Pinkesh Shah on 29-Apr-20
        # Start Region
        self.activeJobTabs = []
        # End Region

        self.tabCtr = 0
        self.tabview = QTabWidget()
        # self.tabview.setStyleSheet(CSS.CSS_TAB)

        self.conn = sqlite3.connect("MikroScript.db")

        self.changeStyle('Windows')
        self.createMenuBar()
        self.tree_dock_widget()
        self.card_dock_widget()
        self.create_dock_widget_area()
        # self.createBottomArea()

        # mainLayout = QGridLayout()
        # # mainLayout.addLayout(self.TopArea   , 0, 0, 1, 3)
        # # mainLayout.addLayout(self.LeftArea  , 1, 0, 1, 1)
        # mainLayout.addLayout(self.RightArea , 1, 1, 1, 2)
        # # mainLayout.addLayout(self.BottomArea, 2, 0, 1, 3)
        # # mainLayout.addWidget(self.topLeftGroupBox, 1, 0)
        # # mainLayout.addWidget(self.topRightGroupBox, 1, 1)
        # # mainLayout.addWidget(self.bottomLeftTabWidget, 2, 0)
        # # mainLayout.addWidget(self.bottomRightGroupBox, 2, 1)
        # # mainLayout.addWidget(self.progressBar, 3, 0, 1, 2)
        # # mainLayout.setRowStretch(1, 1)
        # mainLayout.setColumnStretch(1, 1)
        # mainLayout.setColumnStretch(2, 1)

        # self.plusButton.setFixedSize(20, 20)  # Small Fixed size
        addButton = QPushButton(
            QIcon(self.appctxt.get_resource("add-24px.svg")), "")
        addButton.clicked.connect(self.ActionNew)

        self.tabview.setMovable(True)
        self.tabview.setTabsClosable(True)
        self.tabview.tabCloseRequested.connect(self.removeTab)
        self.tabview.setCornerWidget(addButton)
        # self.tabview = CustomTabWidget()
        self.setCentralWidget(self.tabview)
        self.ActionNew()
        self.get_job_list()
    def setUp(self):
        '''Creates the QApplication instance'''

        # Simple way of making instance a singleton
        super(UsesQApplication, self).setUp()
        global _instance
        if _instance is None:
            # _instance = QApplication([])
            _instance = ApplicationContext()

        self.app = _instance
Пример #24
0
    def loadCSS(self):
        """
			The __init__ method may be documented in either the class level
			docstring, or as a docstring on the __init__ method itself.

			Either form is acceptable, but the two should not be mixed. Choose one
			convention to document the __init__ method and be consistent with it.		
		"""
        css = ApplicationContext().get_resource(
            'styles/notification.css')  # obtener los estilos css
        with open(css, "r") as styles:
            self.setStyleSheet(styles.read())
Пример #25
0
def fix_dark_mode():
    appctxt = ApplicationContext()
    pl = None
    fileName = join(
        "target", appctxt.build_settings["app_name"] + ".app", "Contents", "Info.plist"
    )
    with open(fileName, "rb") as file:
        pl = plistlib.load(file)
        if "NSRequiresAquaSystemAppearance" not in pl:
            pl["NSRequiresAquaSystemAppearance"] = "No"
    with open(fileName, "wb") as file:
        plistlib.dump(pl, file)
Пример #26
0
    def run(self):
        app = ApplicationContext()
        self.create_window()

        app.app.setWindowIcon(QIcon(self.window.icon_path))
        dark_stylesheet = qdarkstyle.load_stylesheet_pyqt5()
        app.app.setStyleSheet(dark_stylesheet)

        self.init_threads()
        exit_code = app.app.exec_()
        self.close_threads()

        return exit_code
Пример #27
0
def parse():

    global data, css

    appctxt = ApplicationContext()
    datafile = appctxt.get_resource('dictionary_data/english.json')
    cssfile = appctxt.get_resource('styles/english.css')

    with open(datafile, encoding='utf8') as df:
        raw = df.read()
    data = json.loads(raw)

    with open(cssfile, encoding='utf8') as cf:
        css = cf.read()
Пример #28
0
    def createAndMaintainButtonClicked(self):
        appctx = ApplicationContext()

        spreadsheet_hdl = SpreadsheetHandler()
        spreadsheet_hdl.rename_spreadsheet(spreadsheet_hdl.file_name + '_OLD')
        spreadsheet_hdl.create_spreadsheet()

        self.resetCategoriesComboBox()

        alert = QMessageBox()
        alert.setWindowTitle("Spreadsheet Reset")
        alert.setWindowIcon(QIcon(appctx.get_resource("sheets.ico")))
        alert.setText("A new spreadsheet was created! To access the old "
                      "spreadsheet, look for Expenses Tracker_OLD in your Drive.")
        alert.exec_()
Пример #29
0
    def delCategoryButtonClicked(self):
        spreadsheet_hdl = SpreadsheetHandler()
        appctx = ApplicationContext()

        category_to_be_del = self.delCategoryComboBox.currentText()

        spreadsheet_hdl.delete_category(category_to_be_del)

        self.resetCategoriesComboBox()

        alert = QMessageBox()
        alert.setWindowTitle("Category Deleting")
        alert.setWindowIcon(QIcon(appctx.get_resource("sheets.ico")))
        alert.setText("The category " + category_to_be_del + " was succesfully deleted!")
        alert.exec_()
Пример #30
0
    def __init__(self, parent=None, submit_icon=None):
        super(WidgetGallery, self).__init__(parent)

        appctx = ApplicationContext()

        spreadsheet_hdl = SpreadsheetHandler()
        categories = spreadsheet_hdl.read_categories()

        self.tabsWidget = QTabWidget()

        # Add 'Expenses' tab to main widget
        self.createExpensesLayout()
        self.tabsWidget.addTab(self.expensesWidget,
                               QIcon(appctx.get_resource("submit.ico")),
                               "Expenses")

        # Add 'Incomes' tab to main widget
        self.createIncomesLayout()
        self.tabsWidget.addTab(self.incomesWidget,
                               QIcon(appctx.get_resource("submit.ico")),
                               "Incomes")

        # Add 'Latest Uploads' tab to main widget
        self.createLatestUploads()
        self.tabsWidget.addTab(self.latestUploadsWidget,
                               QIcon(appctx.get_resource("sheets.ico")),
                               "Latest Uploads")

        # Add 'Spreadsheet Actions' tab to main widget
        self.createSpreadsheetActionsLayout()
        self.tabsWidget.addTab(self.spreadsheetActionsWidget,
                               QIcon(appctx.get_resource("sheets.ico")),
                               "Spreadsheet Actions")

        # Set the current available expenses categories
        self.addCategories(categories)

        # Set main window size
        self.resize(570, 320)

        self.tabsWidget.currentChanged.connect(self.adjustTabWidgetSize)

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.tabsWidget)
        self.setLayout(self.layout)
        self.setWindowTitle("Expenses Tracker")

        QApplication.setStyle(QStyleFactory.create("Fusion"))