Example #1
0
class myWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super(myWindow, self).__init__()
        self.myCommand = " "
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.schedul = elevator_schedul(self.ui)
Example #2
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     #self.writeCaptcha()
     #self.ui.label_2.setScaledContents(True)
     ##QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.fileset)
     self.ui.Login.clicked.connect(self.fileset)
     self.ui.GetVerifycode.clicked.connect(self.GetCaptcha)
     self.ui.verifycode.editingFinished.connect(self.writeCaptcha)
Example #3
0
class MyApp(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self,parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        #self.writeCaptcha()
        #self.ui.label_2.setScaledContents(True)
        ##QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.fileset)
        self.ui.Login.clicked.connect(self.fileset)
        self.ui.GetVerifycode.clicked.connect(self.GetCaptcha)
        self.ui.verifycode.editingFinished.connect(self.writeCaptcha)
        #mainClass = ZhihuHelp()


    def GetCaptcha(self):
        buf = urllib2.urlopen(u'http://www.zhihu.com/captcha.gif')  # 开始拉取验证码
        f = open(u'VerifyCode.gif', 'wb')
        f.write(buf.read())
        f.close()
        codename ='./VerifyCode.gif'
        image = QtGui.QImage(codename)
        pp = QtGui.QPixmap.fromImage(image)
        self.ui.verifycode_label.setPixmap(pp)
        #print u'请输入您所看到的验证码,验证码文件在助手所处的文件夹中,\n双击打开『我是登陆知乎时的验证码.gif』即可\n如果不需要输入验证码可以直接敲击回车跳过该步'
        #with open('./verifycode.txt','r') as verifycode:
           # captcha =  verifycode.read()
           # print(captcha)#raw_input()
        ##return captcha
    def writeCaptcha(self):
        verifycode = self.ui.verifycode.text()
        with open("verifycode.txt",'w') as fverifycode:
            fverifycode.write(verifycode)
    def fileset(self):
        mytext = self.ui.answers.toPlainText()
        ##mylinetext = self.ui.lineEdit.text()
        with open("ReadList.txt",'a') as answer:
            answer.write(mytext)
        ##  answer.write(mylinetext)
        #self.writeCaptcha()




        answers = self.ui.answers.toPlainText()
        #with open("ReadList.txt",'w') as fanswers:
         #   fanswers.write(answers)

        #mainClass = ZhihuHelp()
        mainClass.helperStart(login)
        pass
Example #4
0
class MyApp(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        #self.writeCaptcha()
        #self.ui.label_2.setScaledContents(True)
        ##QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.fileset)
        self.ui.Login.clicked.connect(self.fileset)
        self.ui.GetVerifycode.clicked.connect(self.GetCaptcha)
        self.ui.verifycode.editingFinished.connect(self.writeCaptcha)
        #mainClass = ZhihuHelp()

    def GetCaptcha(self):
        buf = urllib2.urlopen(u'http://www.zhihu.com/captcha.gif')  # 开始拉取验证码
        f = open(u'VerifyCode.gif', 'wb')
        f.write(buf.read())
        f.close()
        codename = './VerifyCode.gif'
        image = QtGui.QImage(codename)
        pp = QtGui.QPixmap.fromImage(image)
        self.ui.verifycode_label.setPixmap(pp)
        #print u'请输入您所看到的验证码,验证码文件在助手所处的文件夹中,\n双击打开『我是登陆知乎时的验证码.gif』即可\n如果不需要输入验证码可以直接敲击回车跳过该步'
        #with open('./verifycode.txt','r') as verifycode:
        # captcha =  verifycode.read()
        # print(captcha)#raw_input()
        ##return captcha
    def writeCaptcha(self):
        verifycode = self.ui.verifycode.text()
        with open("verifycode.txt", 'w') as fverifycode:
            fverifycode.write(verifycode)

    def fileset(self):
        mytext = self.ui.answers.toPlainText()
        ##mylinetext = self.ui.lineEdit.text()
        with open("ReadList.txt", 'a') as answer:
            answer.write(mytext)
        ##  answer.write(mylinetext)
        #self.writeCaptcha()

        answers = self.ui.answers.toPlainText()
        #with open("ReadList.txt",'w') as fanswers:
        #   fanswers.write(answers)

        #mainClass = ZhihuHelp()
        mainClass.helperStart(login)
        pass
Example #5
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self,parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     #self.writeCaptcha()
     #self.ui.label_2.setScaledContents(True)
     ##QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.fileset)
     self.ui.Login.clicked.connect(self.fileset)
     self.ui.GetVerifycode.clicked.connect(self.GetCaptcha)
     self.ui.verifycode.editingFinished.connect(self.writeCaptcha)
Example #6
0
    def __init__(self, app, path, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.app = app
        self.path = path
        self.debug = False
        self.cat_mp3_playlist = QMediaPlaylist()
        self.cat_mp3_playlist.addMedia(
            QMediaContent(
                QtCore.QUrl.fromLocalFile(
                    str(self.path.joinpath("mp3/NyanCat.mp3")))))
        self.cat_mp3_playlist.setPlaybackMode(QMediaPlaylist.Loop)
        self.cat_mp3 = QMediaPlayer()
        self.cat_mp3.setPlaylist(self.cat_mp3_playlist)
        # self.cat_mp3.setMedia(QMediaContent(QtCore.QUrl.fromLocalFile("mp3/NyanCat.mp3")))
        self.cat_mp3.setVolume(100)
        self.cat_mp3.play()

        self.meow_mp3 = QMediaPlayer()
        self.meow_mp3.setMedia(
            QMediaContent(
                QtCore.QUrl.fromLocalFile(
                    str(self.path.joinpath("mp3/meow.m4a")))))
        self.meow_mp3.setVolume(100)
        # self.meow_mp3.play()

        self.FPS = 60
        self.log = self.ui.log_listWidget

        self.default_prize = 100
        self.ui.prize_num_label.setText(str(self.default_prize))

        self.stars = _stars(self, 200, str(self.path.joinpath("pic/meow.png")))
        self.roll = _roll(self)

        self.ui.log_clear_btn.hide()

        self.event_init()
        self.main()
Example #7
0
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self, app, path, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.app = app
        self.path = path
        self.debug = False
        self.cat_mp3_playlist = QMediaPlaylist()
        self.cat_mp3_playlist.addMedia(
            QMediaContent(
                QtCore.QUrl.fromLocalFile(
                    str(self.path.joinpath("mp3/NyanCat.mp3")))))
        self.cat_mp3_playlist.setPlaybackMode(QMediaPlaylist.Loop)
        self.cat_mp3 = QMediaPlayer()
        self.cat_mp3.setPlaylist(self.cat_mp3_playlist)
        # self.cat_mp3.setMedia(QMediaContent(QtCore.QUrl.fromLocalFile("mp3/NyanCat.mp3")))
        self.cat_mp3.setVolume(100)
        self.cat_mp3.play()

        self.meow_mp3 = QMediaPlayer()
        self.meow_mp3.setMedia(
            QMediaContent(
                QtCore.QUrl.fromLocalFile(
                    str(self.path.joinpath("mp3/meow.m4a")))))
        self.meow_mp3.setVolume(100)
        # self.meow_mp3.play()

        self.FPS = 60
        self.log = self.ui.log_listWidget

        self.default_prize = 100
        self.ui.prize_num_label.setText(str(self.default_prize))

        self.stars = _stars(self, 200, str(self.path.joinpath("pic/meow.png")))
        self.roll = _roll(self)

        self.ui.log_clear_btn.hide()

        self.event_init()
        self.main()

    def prize(self, win=False):
        num = int(self.ui.prize_num_label.text())
        if win:
            self.ui.prize_num_label.setText(str(self.default_prize))
            self.log.addItem("您獲得了 {} 元".format(num))
        else:
            self.ui.prize_num_label.setText(str(num + 10))
        pass

    def event_init(self):
        self.ui.pull_btn.clicked.connect(self.event_handle)
        self.installEventFilter(self)
        pass

    def eventFilter(self, obj, event):
        # print(event.type())
        if obj is self and (event.type() == QtCore.QEvent.KeyPress
                            or event.type() == QtCore.QEvent.KeyRelease):
            # print(event)
            if event.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter,
                               QtCore.Qt.Key_Space):
                self.event_handle()
                return True
        return super().eventFilter(obj, event)

    # def keyPressEvent(self, keyEvent):
    # 	self.event_handle()
    # 	# print(keyEvent)
    # 	pass

    def event_handle(self):
        #sender = self.sender()
        # if sender is self.ui.pull_btn or sender is self:
        self.roll.start()
        pass

    def main(self):

        pass