def __init__(self, parent): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/dbs_crt/en_dbs_crt.ui' elif lang == 'Ru_ru': addr = 'res/ui/dbs_crt/ru_dbs_crt.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.ui = uiClass() self.ui.setupUi(self) self.setModal(True) center(self) self.opf = None self.sql = SqlWorker() self.k_file = None self.addr = None self.k_hash = None self.pwd = None self.hsc = Hasher() self.setModal(True) self.connect(self.ui.crt_base, QtCore.SIGNAL('clicked()'), self.opn_dbs) self.connect(self.ui.cls_btn, QtCore.SIGNAL('clicked()'), self.no) self.hash = '' self.connect(self.ui.ch_k_f, QtCore.SIGNAL('clicked()'), self.k_f) self.ui.view_pwd.setCheckable(True) self.connect(self.ui.view_pwd, QtCore.SIGNAL('clicked()'), self.view) self.connect(self.ui.ok_btn, QtCore.SIGNAL('clicked()'), self.ok) self.ui.view_pwd.setIcon(QtGui.QIcon('res/icons/pwd_no.png'))
def __init__(self, parent, base_path, pwd, uids): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/add_data/en.ui' elif lang == 'Ru_ru': addr = 'res/ui/add_data/ru.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.setModal(True) self.uids = uids self.ui = uiClass() self.ui.setupUi(self) self.b_p = base_path self.sql = SqlWorker() self.chi = Chifrator() self.pwd = pwd center(self) self.groups() self.ui.pwd.textChanged.connect(self.edtPwd) self.ui.generate.clicked.connect(self.generate) self.ui.view_pwd.setIcon(QtGui.QIcon('res/icons/pwd_no.png')) self.ui.view_pwd.setCheckable(True) self.ui.view_pwd.clicked.connect(self.view) self.ui.add.clicked.connect(self.add) self.ui.add_group.clicked.connect(self.addGroup) self.ui.prBar.setMinimum(0) self.ui.prBar.setMaximum(300)
def __init__(self, parent, base_pwd, base_addr): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/find/en_find.ui' elif lang == 'Ru_ru': addr = 'res/ui/find/ru_find.ui' self.base_pwd = base_pwd self.base_addr = base_addr self.sql = SqlWorker() uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.ui = uiClass() center(self) self.ui.setupUi(self) self.setModal(True) self.chi = Chifrator() self.clipboard = QtGui.QApplication.clipboard() self.ui.find.clicked.connect(self.find_in_data) self.ui.pwd_v.stateChanged.connect(self.find_in_data) self.actionCopyLogin = QtGui.QAction('Copy login to clipboard', self) self.actionCopyPwd = QtGui.QAction('Copy password to clipboard', self) self.ui.data.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.ui.data.addAction(self.actionCopyLogin) self.ui.data.addAction(self.actionCopyPwd) self.actionCopyLogin.triggered.connect(self.copyLogin) self.actionCopyPwd.triggered.connect(self.copyPassword)
def __init__(self, Uname=None, parent=None, clear=False): """Созадет QWidget таблицу расписания :param Uname: пользователь :param parent: родительское окно :param clear: True - пустая таблица """ super(Table, self).__init__() self.clear = clear self.par = parent # так получаем сыылку на родительское окно для использования на кнопке назад uic.loadUi("table.ui", self) user_size(self) center(self) self.userName = Uname con = sqlite3.connect('db1.db') cur = con.cursor() self.userRight = self.par.userRight self.lbl_user.setText(Uname) # Описание кнопок self.bback.clicked.connect(self.back) # Кнопка НАЗАД self.bsave.clicked.connect(self.save) # Кнопка СОХРАНИТЬ self.bimport.clicked.connect( self.import_table) # Кнопка ЗАГРУЗИТЬ РАСПИСАНИЕ self.bexport.clicked.connect( self.export_table) # Кнопка СОХРАНИТЬ РАСПИСАНИЕ self.bcancel.clicked.connect(self.cancel) # Кнопка ОТМЕНА # заполнение таблицы из бд if not clear: self.fill_table() # растягиваем таблицу на все пространство self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.table.verticalHeader().setSectionResizeMode(QHeaderView.Stretch) self.horizontalSlider.valueChanged[int].connect(self.changeValue)
def __init__(self, parent=None): # поскольку окло логина может вызываться из родительского окна, обязательно добавить аргумент parent super(Reg_window, self).__init__() uic.loadUi("registration.ui", self) user_size(self) center(self) self.par = parent self.reg_button.accepted.connect(self.on_click) # self.login_button.rejected.connect(sys.exit) exit закрывает родительское окно??? self.reg_button.rejected.connect(self.exec)
def __init__(self, parent, base_path): QtGui.QDialog.__init__(self, parent) uiClass, qtBaseClass = uic.loadUiType('res/ui/add_data/add_group.ui') del qtBaseClass self.setModal(True) self.b_p = base_path self.ui = uiClass() center(self) self.ui.setupUi(self) self.name = None self.sql = SqlWorker() self.ui.add.clicked.connect(self.ok) self.ui.no.clicked.connect(self.no)
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/about/about_en.ui' elif lang == 'Ru_ru': addr = 'res/ui/about/about_ru.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.ui = uiClass() center(self) self.ui.setupUi(self) self.setModal(True)
def end(msg): text_alpha = 0 credits_text = public.FONT_LG.render( msg, False, [public.WHITE] * 3) credits_text.set_alpha(text_alpha) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: return 0 elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: return 0 if text_alpha != 255: text_alpha += 5 credits_text.set_alpha(text_alpha) public.screen.fill([public.BLACK] * 3) public.screen.blit(credits_text, functions.center(credits_text)) pygame.display.flip() public.clock.tick(public.FPS)
def __init__(self, parent, base_pwd, base_addr): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/block/en_block.ui' elif lang == 'Ru_ru': addr = 'res/ui/block/ru_block.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.ui = uiClass() center(self) self.ui.setupUi(self) self.base_pwd = base_pwd self.sql = SqlWorker() self.chi = Chifrator() self.base_addr = base_addr self.bool = False self.ui.ok.clicked.connect(self.ok)
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/pwd_gen/en_pwd_gen.ui' elif lang == 'Ru_ru': addr = 'res/ui/pwd_gen/ru_pwd_gen.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.ui = uiClass() center(self) self.ui.setupUi(self) self.generator = MethGen() self.ui.prBar.setMaximum(300) self.ui.prBar.setMinimum(0) self.clipboard = QtGui.QApplication.clipboard() self.ui.generate.clicked.connect(self.generate) self.ui.copy.clicked.connect(self.copy)
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/settings/en_settings.ui' elif lang == 'Ru_ru': addr = 'res/ui/settings/ru_settings.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.ui = uiClass() center(self) self.ui.setupUi(self) self.setModal(True) parser = cfg.ConfigParser() parser.read('res/config.ini') if parser['USER']['passwords_view'] == 'True': self.ui.pwd_v.setChecked(True) self.ui.ok.clicked.connect(self.ok) self.ui.no.clicked.connect(self.no)
def __init__(self): super(Window, self).__init__() path = resource_path('image.png') uic.loadUi("main.ui", self) user_size(self) center(self) self.userRight = None self.userName = None # Меню self.mlogin.setStatusTip('Войти') self.mlogin.triggered.connect(self.menu_login) self.readme.triggered.connect(lambda: os.startfile(r'Readme.txt')) self.autor.aboutToShow.connect( self.set_menu ) # Добавляем в меню Выход, если залогинен пользователь. self.autor.triggered.connect(self.exit_menu) self.reg.setStatusTip('Зарегистрироваться') # Кнопки self.reg.triggered.connect(self.menu_reg) self.bview.clicked.connect(self.view) self.bset.clicked.connect(self.set)
def __init__(self, parent, base_path, pwd, data): """ data = {uid:number; group:group} """ QtGui.QDialog.__init__(self, parent) global lang if lang == 'En_en': addr = 'res/ui/add_data/en_up.ui' elif lang == 'Ru_ru': addr = 'res/ui/add_data/ru_up.ui' uiClass, qtBaseClass = uic.loadUiType(addr) del qtBaseClass self.setModal(True) self.data = data self.ui = uiClass() self.ui.setupUi(self) self.b_p = base_path self.sql = SqlWorker() self.chi = Chifrator() self.pwd = pwd center(self) tmp = self.sql.selectDataFromTable(self.b_p, ('*', '{}'.format( self.data['group']), 'uid = {}'.format(self.data['uid']))) tmp = tmp[0] self.old_pwd = self.chi.decrypt_text(self.pwd, loads(tmp[2])) self.old_login = self.chi.decrypt_text(self.pwd, loads(tmp[1])) self.old_inet = tmp[3] self.ui.inet_addr.setText(self.old_inet) self.ui.login.setText(self.old_login) self.ui.pwd.setText(self.old_pwd) self.ui.repwd.setText(self.old_pwd) self.ui.pwd.textChanged.connect(self.edtPwd) self.ui.generate.clicked.connect(self.generate) self.ui.view_pwd.setIcon(QtGui.QIcon('res/icons/pwd_no.png')) self.ui.view_pwd.setCheckable(True) self.ui.view_pwd.clicked.connect(self.view) self.ui.add.clicked.connect(self.add) self.ui.prBar.setMaximum(300) self.ui.prBar.setMinimum(0)
def title(): pygame.display.set_caption('Contrast') pygame.display.set_icon(dictionaries.MEDIA['icon']) info_text = public.FONT_LG.render('ENTER TO BEGIN; ? FOR CREDITS', False, public.WHITE) in_credits = False while True: for event in pygame.event.get(): if event.type == pygame.QUIT: return 0 elif event.type == pygame.KEYDOWN: if event.key == pygame.K_SLASH: if in_credits: in_credits = False elif not in_credits: in_credits = True elif event.key == pygame.K_RETURN: game() return 0 public.screen.fill(public.BLACK) if not in_credits: public.screen.blit(dictionaries.MEDIA['logo'], functions.center(dictionaries.MEDIA['logo'])) public.screen.blit(info_text, (functions.center(info_text)[0], 290)) elif in_credits: public.screen.blit(dictionaries.MEDIA['credits'], functions.center(dictionaries.MEDIA['credits'])) pygame.display.flip() public.clock.tick(public.FPS)
def fill_table(self): """Заполнение таблицы из бд""" con = sqlite3.connect('db1.db') cur = con.cursor() if self.userRight == 'admin' or self.userRight == None: sql = '''SELECT DISTINCT timetable.lesson FROM timetable''' # Выбираем все существующие уроки в расписании else: sql = '''SELECT DISTINCT timetable.lesson FROM timetable,user WHERE timetable.teacher_id=user.id AND user.login="******"'''.format( self.userName ) # Выбираем все существующие уроки данного учителя в расписании result = cur.execute(sql).fetchall() for item in result: row, column = map(int, item[0].split()) if self.userRight == 'admin' or self.userRight == None: if self.userRight is None: self.bcancel.hide() self.bsave.hide() self.bimport.hide() sql = '''SELECT user.name, student.surname FROM timetable,user,student WHERE timetable.teacher_id=user.id AND student.id=timetable.student_id AND timetable.lesson="{}"'''.format( item[0]) self.resize(self.width() * 1.01, self.height() * 1.02) center(self) day = '\n'.join([ ' '.join(list(item)) for item in cur.execute(sql).fetchall() ]) else: self.bimport.hide() sql = '''SELECT student.surname FROM timetable,user,student WHERE timetable.teacher_id=user.id AND student.id=timetable.student_id AND timetable.lesson="{}" AND user.login="******"'''.format( item[0], self.userName) day = cur.execute(sql).fetchone()[0] self.table.setItem(row, column, QTableWidgetItem(day)) con.close()
def title(debug): pygame.display.set_caption('Contrast') pygame.display.set_icon(pygame.image.fromstring(bz2.decompress( dictionaries.MEDIA['icon']), (32, 32), 'RGBA')) info_text = public.FONT_LG.render( 'ENTER TO BEGIN', False, [public.WHITE] * 3) play_button = sprites.Button((343, 290), 'Play') music_button = sprites.Button((407, 290), 'Music') button_cover = pygame.Surface((public.SWIDTH, 10)) button_cover.fill([public.BLACK] * 3) if len(debug) != 1: public.music = False m = re.search('map_(.+?).tmx', debug[1]) if m: public.level = int(m.group(1)) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: return 0 public.all_sprites.update() if public.end_title: game() return 0 public.screen.fill([public.BLACK] * 3) public.screen.blit(dictionaries.IMAGES['Logo'], functions.center( dictionaries.IMAGES['Logo'])) for sprite in public.all_sprites: sprite.draw() public.screen.blit(button_cover, (0, 345)) pygame.display.flip() public.clock.tick(public.FPS)
def cent(self): fun.center(self.servselect.get(), self.ser)
func.max_by_col(finger_point_pos, 1) ] max_point_a = [ func.max_by_col(finger_angle_pos, 0), func.max_by_col(finger_angle_pos, 1) ] # topLeft = [ # int(min_point_a[0] if min_point_f[0] > min_point_a[0] else min_point_f[0]), # int(min_point_a[1] if min_point_f[1] > min_point_a[1] else min_point_f[1]) # ] # bottomRight = [ # int(max_point_a[0] if max_point_f[0] < max_point_a[0] else max_point_f[0]), # int(max_point_a[1] if max_point_f[1] < max_point_a[1] else max_point_f[1]) # ] centerPos = func.center(finger_point_pos) cv2.circle(drawing, (centerPos[0], centerPos[1]), 5, [255, 0, 0], 1) if status_mouse: delta = [ a_i - b_i for a_i, b_i in zip(prevCenter, centerPos) ] # mouse = PyMouse() # mPos = mouse.position() # pyautogui.moveTo(mPos[0]+delta[0], mPos[1]+delta[1]) pyautogui.FAILSAFE = False pyautogui.moveRel(abs(-delta[0] * 2), abs(-delta[1] * 2)) prevCenter = centerPos