def __init__(self, resources): super().__init__() self.versionNumber = '1.2.7' self.title = 'Monkey See Monkey Do v'+self.versionNumber self.left = 10 self.top = 80 self.width = 640 self.height = 100 self.folderName = '' self.imageList = [] self.numImages = 0 self.currentImageNumber = 0 self.currentTotalImageNumber = 0 self.hotSpotFilename = 'hotspots.json' self.hotSpotFile = None self.hotSpotSize = 50 self.currentHotSpot = None self.startTime = None self.endTime = None self.robot = [] self.screen = QDesktopWidget().availableGeometry() self.platform = platform.name() self.resources = resources print(self.screen) print('Operating System: ', self.platform) print('Screen: width:', self.screen.width(), 'height:', self.screen.height()) self.initUI()
def init(project_dir): """ Call this if you are not invoking `python -m fbs` or fbs.cmdline.main(). """ SETTINGS['project_dir'] = abspath(project_dir) activate_profile('base') activate_profile(platform.name().lower())
def database_select_dialog(self, s): options = QFileDialog.Options() filename, _ = QFileDialog.getOpenFileName(None, "Select Database", "", "Database Files (*.db)", options=options) settings = QSettings("OLDI", "Nandre") if name() == "Windows": settings.setValue("windows_db_path", filename) self.database.update(filename) elif name() == "Linux": settings.setValue("linux_db_path", filename) self.database.update(filename) del settings
def __init__(self, appctxt_cls): project_dir = self._get_project_base_dir(appctxt_cls) resources_dir = join(project_dir, 'src', 'main', 'resources') resource_dirs = [ join(resources_dir, platform.name().lower()), join(resources_dir, 'base'), join(project_dir, 'src', 'main', 'icons') ] super().__init__(resource_dirs)
def backup(self): settings = QSettings("OLDI", "Nandre") today = date.today() if name() == 'Windows': db_path = Path(settings.value("windows_db_path")) backup_dir_parent = backup_dir.parent backup_path = os.path.join( backup_dir_parent, ''.join([db_path.stem, str(today), db_path.suffix])) shutil.copy2(db_path, backup_path)
def update(self, db_path): self.settings = QSettings("OLDI", "Nandre") if name() == 'Windows': if self.con: self.con.close() self.con = None self.con = sqlite3.connect(db_path) self.settings.setValue("windows_db_path", db_path) else: if self.con: self.con.close() self.con = None self.con = sqlite3.connect(db_path) self.settings.setValue("linux_db_path", db_path)
def init(project_dir): """ Call this if you are not invoking `python -m fbs` or fbs.cmdline.main(). """ SETTINGS['project_dir'] = abspath(project_dir) activate_profile('base') activate_profile(platform.name().lower()) if is_linux(): if is_ubuntu(): activate_profile('ubuntu') elif is_arch_linux(): activate_profile('arch') elif is_fedora(): activate_profile('fedora')
def get_default_profiles(): result = ['base'] # The "secret" profile lets the user store sensitive settings such as # passwords in src/build/settings/secret.json. When using Git, the user can # exploit this by adding secret.json to .gitignore, thus preventing it from # being uploaded to services such as GitHub. result.append('secret') result.append(platform.name().lower()) if is_linux(): if is_ubuntu(): result.append('ubuntu') elif is_arch_linux(): result.append('arch') elif is_fedora(): result.append('fedora') return result
def database(self): database = Database() settings = QSettings("OLDI", "Nandre") #settings.setValue("windows_db_path", r'D:\Proiecte\Python\OLDI\src\main\resources\base\DBs\Biblioteca.db') if name() == 'Windows': db_path = settings.value("windows_db_path") if db_path == None: self.window.database_select_dialog("s") else: database.update(db_path) else: db_path = settings.value("linux_db_path") if db_path == None: self.window.database_select_dialog("s") else: database.update(db_path) del settings return database
self.genre_combobox.currentIndex()) self.accept() class RestartDialog(QDialog): def __init__(self, ui): super(RestartDialog, self).__init__() uic.loadUi(ui, self) print(ui) #------------------MAIN-------------------------------------- if __name__ == '__main__': appctxt = OLDIContext() if name() == 'Windows': # Windows file dir \ main_ui = appctxt.get_resource(r'UIs\main.ui') books_ui = appctxt.get_resource(r'UIs\books.ui') students_ui = appctxt.get_resource(r'UIs\students.ui') borrows_ui = appctxt.get_resource(r'UIs\borrows.ui') add_borrow_dialog = appctxt.get_resource(r'UIs\add_borrow.ui') student_dialog = appctxt.get_resource(r'UIs\student_dialog.ui') borrow_dialog_ui = appctxt.get_resource(r'UIs\borrow_dialog.ui') borrow_edit_dialog_ui = appctxt.get_resource( r'UIs\borrow_edit_dialog.ui') books_import_dialog_ui = appctxt.get_resource( r'UIs\books_import_dialog.ui') restart_dialog_ui = appctxt.get_resource(r'UIs\restart_dialog.ui') else: #Linux file dir / main_ui = appctxt.get_resource(r'UIs/main.ui') books_ui = appctxt.get_resource(r'UIs/books.ui')
def _on_sentry_init(self): scope = self.sentry_exception_handler.scope from fbs_runtime import platform scope.set_extra('os', platform.name()) scope.set_extra('build', AppInfo().version())
def _on_sentry_init(self): scope = self.sentry_exception_handler.scope scope.set_extra("os", platform.name()) scope.set_tag("server_type", ENV_TYPE)
def _on_sentry_init(self): scope = self.sentry_exception_handler.scope scope.set_extra('os', platform.name())