当前位置: 首页>>代码示例>>Python>>正文


Python User.start方法代码示例

本文整理汇总了Python中user.User.start方法的典型用法代码示例。如果您正苦于以下问题:Python User.start方法的具体用法?Python User.start怎么用?Python User.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.User的用法示例。


在下文中一共展示了User.start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import start [as 别名]
    def run(self):
        url = "http://www.zhihu.com/answer/24001938"
#         url = "http://www.zhihu.com/answer/23990424/voters_profile"
#      test = zhihuAnj("http://www.zhihu.com/answer/23966524")
        test = zhihuAnj(url)
        ret = test.start();
        brain = Brain(ret)  
#         print brain.getLikeByRange()
        user = User("http://www.zhihu.com/question/29739045")
        print user.start()
开发者ID:sdgdsffdsfff,项目名称:ZhuhuChart,代码行数:12,代码来源:main.py

示例2:

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import start [as 别名]
#!/usr/bin/env python
#-*- coding:utf-8 -*-

from user import User
from maker import Maker
from shareInt import ShareInt

shareObject=ShareInt()
user1=User("user1",shareObject)
maker1=Maker("maker1",shareObject)

user1.start()
maker1.start()

user1.join()
maker1.join()

user1.display()

print "main threading over!"
开发者ID:Rming,项目名称:python-snippets,代码行数:22,代码来源:test.py

示例3: Ui_MainWindow

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import start [as 别名]
class Ui_MainWindow(QtGui.QWidget):
    __msg = None

    #login    = 'user'
    #password = 'password'
    myPort     = 52010
    clPort     = 52020
    

    def __init__(self, parent = None):
        
        QtGui.QWidget.__init__(self, parent)
        self.login    = self.showDialog('Авторизация', 'Введите логин')
        inputPassword = self.showDialog('Авторизация', 'Введите пароль')
        self.myUser   = User(self.login, self.myPort)

        if self.myUser.password is None:
            self.password = self.myUser.reg(inputPassword)

        if self.myUser.password != hex(GOST(256).hash(inputPassword.encode('hex') + self.login.encode('hex'))):
            self.error('Ошибка','Неверный логин или пароль')

        self.myUser.start()
        t = threading.Thread(target=self.listen)
        t.daemon = True
        t.start()  

        QtCore.QObject.connect(self,QtCore.SIGNAL("msg(QString)"),self.showMsg) 


    def listen(self):
        host = 'localhost'
        p    = self.myPort

        self.socket = socket(AF_INET, SOCK_STREAM)
        self.socket.bind((host, p))
        self.socket.listen(1)

        while 1:
            csocket, caddress = self.socket.accept()
            while 1:
                data = csocket.recv(4096)
                if not data: break
                self.__msg = data
                s = QtCore.QString()
                for i in self.__msg:
                    s.append(i)
                if self.myUser.checkSign('test',s):
                	self.emit(QtCore.SIGNAL("msg(QString)"), s)
                else:
                	self.error("Внимание", "Сообщение неверно!!!")

            

    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(480, 640)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.sendButton = QtGui.QPushButton(self.centralwidget)
        self.sendButton.setGeometry(QtCore.QRect(370, 540, 98, 27))
        self.sendButton.setObjectName(_fromUtf8("sendButton"))
        self.textEdit = QtGui.QTextEdit(self.centralwidget)
        self.textEdit.setGeometry(QtCore.QRect(10, 467, 461, 61))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.textBrowser = QtGui.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QtCore.QRect(10, 20, 461, 441))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 480, 25))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.sendButton.clicked.connect(self.send)

    def showDialog(self, title, request):
            
        text, ok = QtGui.QInputDialog.getText(self, _fromUtf8(title), 
            _fromUtf8(request))
            
        if ok:
            return str(text)

    def error(self, title, describe):
        QtGui.QMessageBox.critical(
        self,
        _fromUtf8(title),
        _fromUtf8(describe),
        QtGui.QMessageBox.Cancel
        )
        sys.exit(1)

    def retranslateUi(self, MainWindow):
#.........这里部分代码省略.........
开发者ID:aeksei,项目名称:project,代码行数:103,代码来源:main.py


注:本文中的user.User.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。