コード例 #1
0
ファイル: MainMenuDialog.py プロジェクト: alferbus/TFGv3
    def conf_session(self):
        """This can be selected by the user to select both a different 
		user and a different car. It does so by going back to the Login Dialog. """
        from LoginDialog import LoginDialog
        login = LoginDialog(self.obd_path, self.data)
        self.close()
        login.exec_()
コード例 #2
0
ファイル: Main.py プロジェクト: imbi7py/SpatMan
def main():
    app = QApplication(sys.argv)

    while True:
        loginDialog = LoginDialog()
        if loginDialog.exec() == LoginDialog.Rejected:
            return
        db, userName, password = loginDialog.result()

        try:
            database = Database(db, userName, password)
            break
        except WrongUserPass as e:
            QMessageBox.warning(None, "Error", "Wrong username or password")
            continue
        except Exception as e:
            QMessageBox.warning(None, "Error",
                                "Failed to open database: \n" + str(e))
            return

    config = Configuration()
    config.addRecentDB(db)

    wnd = MainWindow(database)
    wnd.show()
    res = app.exec_()
    try:
        config.save()
    except Exception as e:
        print("Error: %s" % str(e))
    return res
コード例 #3
0
ファイル: main.py プロジェクト: onurcanozkaya/MailClient
 def login(self):
     sender = self.sender()
     login = LoginDialog(parent=self, pop3=self.pop3, parentWindow=main)
     self.loginButton.hide()
     login.show()
     if not login.exec_():
         self.statusBar().showMessage('Log in cancelled')
コード例 #4
0
def main():
    app = QApplication(sys.argv)
    dialog = LoginDialog()
    if dialog.exec_():
        mainWindow = MainUI()
        mainWindow.setUsername(dialog.username)
        mainWindow.show()
        sys.exit(app.exec_())
コード例 #5
0
 def login_dialog(self):
     global app
     if (self.maya_enabled):
         app = QtGui.QApplication(sys.argv)
         login = LoginDialog()
         login.show()
         time.sleep(0.02)
         app.exec_()
     return login.getLoginDetails()
コード例 #6
0
ファイル: WelcomeDialog.py プロジェクト: alferbus/TFGv3
    def check_GPS_show_users(self):
        """GPS FIX"""
        #Sets flat 'show user list button' so that the user knows the
        #software is still working.""
        self.ui.pushButtonUserList.setFlat(True)
        self.ui.pushButtonUserList.setText(u"Espere al FIX del GPS...")
        #R-pi GPSD needs to be disabled as well:
        """Raspbian default install already features a gpsd daemon of 
		its own. We will be calling it on demand so it needs to be
		disabled due to compatibility issues, as both instances cannot be
		running at once."""
        os.system('sudo systemctl stop gpsd.socket')
        os.system('sudo systemctl disable gpsd.socket')
        """ Communication with the GPS device takes place using the agps3
		library, available through pip. This library acts as an interface
		to parse the raw data provided by the gpsd daemon. In order to
		get the data a GPS fix (i.e. a working satellite link) is
		required. """
        try:
            gpsd_socket = agps3.GPSDSocket()  #Opens a 'socket' form which
            #can be polled
            data_stream = agps3.DataStream()  #Opens a new data stream
            #inside the socket
            gpsd_socket.connect()  #Links to the socket.
            gpsd_socket.watch()  #Watches the socket for changes.
            #Tries to grab an object from the data stream.
            #If no new objects are found inside the data stream, an
            #exception is issued warning the user to check the gps link.
            #If there's a working link but no fix, then the gps device
            #will be repeatedly polled until success.
            #Meanwhile, the user is instructed to wait patiently.
            for new_data in gpsd_socket:
                if new_data:
                    data_stream.unpack(new_data)
                if data_stream.lat != 'n/a':
                    break
        except (OSError, IOError):
            mb = QtGui.QMessageBox(u'Advertencia',
                                   u'Compruebe la conexión del GPS',
                                   QtGui.QMessageBox.Warning,
                                   QtGui.QMessageBox.Ok, 0, 0)
            mb.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            mb.setAttribute(QtCore.Qt.WA_DeleteOnClose,
                            True)  # delete dialog on close
            mb.exec_()  #prevent focus loss
            raise SystemExit  #No gps device found -- QUIT

        #Now a login dialog object is created with all the
        #collected user data as an argument
        from LoginDialog import LoginDialog
        login = LoginDialog(self.obd_path, self.data)
        self.close()  #closes login dialog
        login.exec_()  #keeps focus on loginion dialog
コード例 #7
0
    def link_admin_click(self, **event_args):
        """This method is called when the link is clicked"""

        user = anvil.users.get_user()

        if user is not None and user['email'] == '*****@*****.**':

            open_form('Admin')
        else:

            d = LoginDialog()
            choice = alert(d)
            if 1:
                if app_tables.admins.get(
                        Email=d.email_box.text) and app_tables.admins.get(
                            Password=d.password_box.text):
                    open_form('Admin')
                else:
                    alert(
                        'Password and email are invalid.This link is only for Admin'
                    )
コード例 #8
0
def login_with_form(allow_cancel=True):
  """Log in by popping up the custom LoginDialog"""
  d = LoginDialog()
  
  BUTTONS = [("Log in", "login", "primary")]
  if allow_cancel:
    BUTTONS += [("Cancel", None)]
  
  while anvil.users.get_user() is None:
    choice = anvil.alert(d, title="Log In", dismissible=allow_cancel, buttons=BUTTONS)
    
    if choice == 'login':
      try:
        anvil.users.login_with_email(d.email_box.text, d.password_box.text, remember=True)
      except anvil.users.EmailNotConfirmed:
        d.confirm_lnk.visible = True
      except anvil.users.AuthenticationFailed as e:
        d.login_err_lbl.text = str(e.args[0])
        d.login_err_lbl.visible = True
        
    elif choice == 'reset_password':
      fp = ForgottenPasswordDialog(d.email_box.text)
      
      if anvil.alert(fp, title='Forgot Password', buttons=[("Reset password", True, "primary"), ("Cancel", False)]):
        
        if anvil.server.call('_send_password_reset', fp.email_box.text):
          anvil.alert("A password reset email has been sent to %s." % fp.email_box.text)
        else:
          anvil.alert("That username does not exist in our records.")
        
    elif choice == 'confirm_email':
      if anvil.server.call('_send_email_confirm_link', d.email_box.text):
        anvil.alert("A new confirmation email has been sent to %s." % d.email_box.text)
      else:
        anvil.alert("'%s' is not an unconfirmed user account." % d.email_box.text)
      d.confirm_lnk.visible = False
    
    elif choice is None and allow_cancel:
      break
コード例 #9
0
def login():
    dialog = LoginDialog()
    if dialog.exec_():
        return True
    else:
        return False
コード例 #10
0
 def __init__(self, parent=None):
     super(PlayerGui, self).__init__(parent)
     self.player = None
     self.loginDialog = LoginDialog(self)
     self.loginDialog.show()
コード例 #11
0
    def __init__(self):
        Gtk.Window.__init__(self, title="Cloud Disk")

        self.set_border_width(10)
        self.maximize()
        #Setting up the self.grid in which the elements are to be positionned
        self.grid = Gtk.Grid()
        self.grid.set_column_homogeneous(True)
        self.grid.set_row_homogeneous(True)
        self.add(self.grid)
        #box = Gtk.Box(spacing=6)
        #self.add(box)
        self.tokens = auth.index()

        self.bdstoken, self.sign1, self.sign3, self.timestamp = self.tokens

        #self.connect('activate', self.on_login_dialog_close)
        #self.connect("delete-event", Gtk.main_quit)
        if not self.bdstoken:
            dialog = LoginDialog(self)
            #dialog.connect("close",self.on_login_dialog_close)
            response = dialog.run()

            dialog.destroy()
            if response == Gtk.ResponseType.DELETE_EVENT:
                print(response)
                print("quit")
                #self.close()

                self.destroy()
                return
            elif response == 11:
                print("login")
            else:
                return
        self.down_list = []

        self.current_path = "/"
        self.current_selection = None
        ##							   num,pix,filename,size,path,isdir,fsid,cate,spath,speed,progress,status
        #                              0   1   2        3     4    5     6    7    8     9     10       11
        self.liststore = Gtk.ListStore(int, GdkPixbuf.Pixbuf, str, str, str,
                                       int, str, int, str, str, int, str)
        self.current_list = []
        #self.loading_spin = Gtk.Spinner()
        #self.loading_spin.props.valign = Gtk.Align.CENTER
        #box.pack_start(self.loading_spin, False, False, 0)
        #self.grid.add(self.loading_spin)

        self.init_view(self.current_path)
        #self.spinn.hide()
        #list_json = cloudapi.list_path(self.current_path,500,settings.DRY,self.bdstoken)
        #logger.debug("list json: %s"%str(len(list_json))
        #file_list = cloudapi.get_list(list_json)
        #logger.debug("file_list: %s"%str(file_list))

        #self.populate_view(file_list)

        self.stop_gif = False

        #creating the treeview, making it use the filter as a model, and adding the columns
        self.treeview = Gtk.TreeView(model=self.liststore)
        for i, column_title in enumerate(
            ["Num", "Thumb", "File", "Size", "Path"]):
            if column_title != "Thumb":
                renderer = Gtk.CellRendererText()
                column = Gtk.TreeViewColumn(column_title, renderer, text=i)
            else:
                renderer_pixbuf = Gtk.CellRendererPixbuf()

                column = Gtk.TreeViewColumn(column_title,
                                            renderer_pixbuf,
                                            pixbuf=i)

            #if not column_title == 'isdir' and not column_title == 'fsid' and not column_title == 'cate'  :
            self.treeview.append_column(column)

        self.treeview.props.activate_on_single_click = False
        self.treeview.connect("row-activated", self.on_row_double_click)

        self.selection = self.treeview.get_selection()
        self.selection.connect("changed", self.on_tree_selection_changed)
        self.selection.set_mode(Gtk.SelectionMode.MULTIPLE)
        #select = selection.get_selected_rows()

        #creating buttons to filter by programming language, and setting up their events
        self.buttons = list()
        for act in [
                "Up level", "Refresh View", "Batch Add Task", "Remove File",
                "Download", "CleanUp", "Search"
        ]:
            button = Gtk.Button(act)
            self.buttons.append(button)
            funcname = "on_%s_button_clicked" % act.lower().replace(" ", "_")
            print(funcname)
            func = getattr(self, funcname)
            button.connect("clicked", func)

        #setting up the layout, putting the treeview in a scrollwindow, and the buttons in a row
        self.scrollable_treelist = Gtk.ScrolledWindow()
        self.scrollable_treelist.set_vexpand(True)
        #self.grid.attach(self.loading_spin, 0, 0, 10, 20)
        #self.grid.attach_next_to(self.scrollable_treelist,self.loading_spin, Gtk.PositionType.BOTTOM, 10, 23)
        self.grid.attach(self.scrollable_treelist, 0, 0, 8, 20)
        #box.pack_start(self.scrollable_treelist, True, True, 0)
        self.grid.attach_next_to(self.buttons[0], self.scrollable_treelist,
                                 Gtk.PositionType.BOTTOM, 1, 1)
        for i, button in enumerate(self.buttons[1:]):
            self.grid.attach_next_to(button, self.buttons[i],
                                     Gtk.PositionType.RIGHT, 1, 1)
            #self.add_action_widget(self.buttons[i],i+1)
            #box.pack_start(self.buttons[i], False, False, 0)
        self.scrollable_treelist.add(self.treeview)

        #box.show_all()
        self.grid.show_all()
コード例 #12
0
ファイル: Main.py プロジェクト: xiongmin666666/Crawler_UI_New
 def loginSlot(self):
     res = LoginDialog().work()
     if res:
         self.tabWidget.setEnabled(True)
         self.label_2.setText("欢迎登陆," + res)
コード例 #13
0
        msg = {}
        msg["cmd"] = 'send_control_code'
        code = '{:04X}'.format(code)  # 十进制控制代码转十六进制
        msg['machine_number'] = "%d" % machine_number
        msg['code'] = "%s" % code

        message.append(msg)


if __name__ == '__main__':
    app = QApplication([])  # 初始化应用

    #
    # 检查是否需要验证产品密钥
    #
    login_dial = LoginDialog()
    if login_dial.check() or login_dial.exec_():
        #
        # 显示界面
        #
        main_window = MainWindow()  # 创建主窗口
        # main_window.ui.show()  # 按实际大小显示窗口
        main_window.ui.showMaximized()  # 全屏显示窗口,必须要用,不然不显示界面

        #
        # 子线程启动
        #
        serial_worker = SerialWorker(main_window)
        serial_worker.start()
        check_worker = CheckWorker(main_window)
        check_worker.start()