コード例 #1
0
    def __init__(self, parent):
        QMessageBox.__init__(self, parent)
        self.setWindowTitle(_('Shutting down'))
        
        self.setIconPixmap(QPixmap('ochdownload2.png'))
        
        self.setText(_("The system is going to shut down."))
        
        self.setStandardButtons(QMessageBox.Cancel)
        self.setDefaultButton(QMessageBox.Cancel)
        #self.setEscapeButton(QMessageBox.Cancel)
        
        self.timeout = TIME_OUT
        
        self.timer = parent.idle_timeout(1000, self.update)

        #Flash if the window is in the background.
        if cons.OS_WIN:
            flash_wnd.flash_taskbar_icon(parent.winId())
コード例 #2
0
ファイル: choice_gui.py プロジェクト: AbdullZ7/ochDownloader
    def __init__(self, f_name, choices_list, parent):
        """"""
        QDialog.__init__(self, parent,
                         Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
        self.setWindowTitle(f_name)
        self.resize(340, 200)

        self.solution = None

        vbox = QVBoxLayout()
        vbox.setSpacing(20)
        self.setLayout(vbox)

        #captcha image
        self.cb = QComboBox()
        [self.cb.addItem(choice) for choice in choices_list]
        vbox.addWidget(self.cb)

        #buttons
        vbox.addStretch()

        hbox_btns = QHBoxLayout()
        vbox.addLayout(hbox_btns)

        hbox_btns.addStretch()

        btn_ok = QPushButton(_('OK'))
        btn_ok.setDefault(True)
        btn_ok.clicked.connect(self.on_ok)
        btn_ok.setFixedHeight(35)
        btn_ok.setMaximumWidth(80)
        hbox_btns.addWidget(btn_ok)

        self.cb.setFocus()  #call after creating all of the other widgets.

        #Flash if the window is in the background.
        if flash_wnd is not None:
            flash_wnd.flash_taskbar_icon(parent.winId())

        self.exec_()
        self.deleteLater()
コード例 #3
0
    def __init__(self, f_name, choices_dict, parent):
        """"""
        QDialog.__init__(self, parent, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
        self.setWindowTitle("{f_name}".format(f_name=f_name))
        self.resize(340, 200)

        self.choices_dict = choices_dict
        self.solution = None

        vbox = QVBoxLayout()
        vbox.setSpacing(20)
        self.setLayout(vbox)

        #captcha image
        self.cb = QComboBox()
        [self.cb.addItem(quality) for quality in self.choices_dict.values()]
        vbox.addWidget(self.cb)

        #buttons
        vbox.addStretch()

        hbox_btns = QHBoxLayout()
        vbox.addLayout(hbox_btns)

        hbox_btns.addStretch()

        btn_ok = QPushButton(_('OK'))
        btn_ok.setDefault(True)
        btn_ok.clicked.connect(self.on_ok)
        btn_ok.setFixedHeight(35)
        btn_ok.setMaximumWidth(80)
        hbox_btns.addWidget(btn_ok)

        self.cb.setFocus() #call after creating all of the other widgets.

        #Flash if the window is in the background.
        if flash_wnd is not None:
            flash_wnd.flash_taskbar_icon(parent.winId())

        self.exec_()
コード例 #4
0
    def __init__(self, parent):
        QMessageBox.__init__(self, parent)
        self.setWindowTitle(_('Shutting down'))
        
        #self.setIconPixmap(QPixmap('ochdownload2.png'))
        
        self.setText(_("The system is going to shut down."))

        btn_cancel = self.addButton(QMessageBox.Cancel)
        btn_cancel.clicked.connect(self.reject)
        self.setDefaultButton(QMessageBox.Cancel)
        #self.setEscapeButton(QMessageBox.Cancel)
        
        self.timeout = TIME_OUT
        
        self.timer = parent.idle_timeout(1000, self.update_)

        #Flash if the window is in the background.
        if flash_wnd is not None:
            flash_wnd.flash_taskbar_icon(parent.winId())

        self.exec_()
コード例 #5
0
    def __init__(self, parent):
        QMessageBox.__init__(self, parent)
        self.setWindowTitle(_('Shutting down'))

        #self.setIconPixmap(QPixmap('ochdownload2.png'))

        self.setText(_("The system is going to shut down."))

        btn_cancel = self.addButton(QMessageBox.Cancel)
        btn_cancel.clicked.connect(self.reject)
        self.setDefaultButton(QMessageBox.Cancel)
        #self.setEscapeButton(QMessageBox.Cancel)

        self.timeout = TIME_OUT

        self.timer = parent.idle_timeout(1000, self.update_)

        #Flash if the window is in the background.
        if flash_wnd is not None:
            flash_wnd.flash_taskbar_icon(parent.winId())

        self.exec_()
        self.deleteLater()
コード例 #6
0
    def __init__(self, service, get_captcha, parent):
        """"""
        QDialog.__init__(self, parent, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
        #self.set_icon(self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU))
        self.setWindowTitle("{service_name} captcha".format(service_name=service))
        self.resize(340, 200)

        self.weak_parent = weakref.ref(parent)
        self.get_captcha = get_captcha
        self.solution = None
        self.timeout = TIMEOUT
        
        vbox = QVBoxLayout()
        vbox.setSpacing(20)
        self.setLayout(vbox)
        
        #captcha image
        #self.image = QPixmap()
        self.label = QLabel()
        self.load_image()
        #self.label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #self.label.setPixmap(self.image)
        vbox.addWidget(self.label)
        
        #input
        hbox_input = QHBoxLayout()
        vbox.addLayout(hbox_input)
        
        self.label_expires = QLabel("{} {}".format(_("Expires in"), self.timeout))
        hbox_input.addWidget(self.label_expires)
        
        self.entry_input = QLineEdit()
        hbox_input.addWidget(self.entry_input)
        
        #buttons
        vbox.addStretch()
        
        hbox_btns = QHBoxLayout()
        vbox.addLayout(hbox_btns)
        
        btn_cancel = QPushButton(_('Cancel'))
        btn_cancel.clicked.connect(self.on_cancel)
        btn_cancel.setFixedHeight(35)
        btn_cancel.setMaximumWidth(80)
        hbox_btns.addWidget(btn_cancel)
        
        hbox_btns.addStretch()
        
        btn_refresh = QPushButton(_('Refresh'))
        btn_refresh.clicked.connect(self.on_refresh)
        btn_refresh.setFixedHeight(35)
        btn_refresh.setMaximumWidth(80)
        hbox_btns.addWidget(btn_refresh)
        
        btn_ok = QPushButton(_('OK'))
        btn_ok.setDefault(True)
        btn_ok.clicked.connect(self.on_ok)
        btn_ok.setFixedHeight(35)
        btn_ok.setMaximumWidth(80)
        hbox_btns.addWidget(btn_ok)
        
        #expires update
        self.timer = parent.idle_timeout(1000, self.expire_update)
        
        #note: if does not work, use singleShot timer.
        self.entry_input.setFocus() #call after creating all of the other widgets.

        #Flash if the window is in the background.
        if flash_wnd is not None:
            flash_wnd.flash_taskbar_icon(parent.winId())
        
        self.exec_()
コード例 #7
0
ファイル: captcha_gui.py プロジェクト: AbdullZ7/ochDownloader
    def __init__(self, host, challenge, parent):
        """"""
        QDialog.__init__(self, parent,
                         Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
        #self.set_icon(self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU))
        self.setWindowTitle("{host} captcha".format(host=host))
        self.resize(340, 200)

        self.weak_parent = weakref.ref(parent)
        self.host = host
        self.challenge = challenge
        self.th_challenge_request = threading.Thread(
            group=None, target=self.challenge.request, name=None)
        self.th_challenge_request.start()
        self.solution = None
        self.timeout = TIMEOUT

        vbox = QVBoxLayout()
        vbox.setSpacing(20)
        self.setLayout(vbox)

        #captcha image
        #self.image = QPixmap()
        self.label = QLabel()
        self.label.setText(_('Loading...'))
        #self.label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #self.label.setPixmap(self.image)
        vbox.addWidget(self.label)

        #input
        hbox_input = QHBoxLayout()
        vbox.addLayout(hbox_input)

        self.label_expires = QLabel("{} {}".format(_("Expires in"),
                                                   self.timeout))
        hbox_input.addWidget(self.label_expires)

        self.entry_input = QLineEdit()
        hbox_input.addWidget(self.entry_input)

        #buttons
        vbox.addStretch()

        hbox_btns = QHBoxLayout()
        vbox.addLayout(hbox_btns)

        btn_cancel = QPushButton(_('Cancel'))
        btn_cancel.clicked.connect(self.on_cancel)
        btn_cancel.setFixedHeight(35)
        btn_cancel.setMaximumWidth(80)
        hbox_btns.addWidget(btn_cancel)

        hbox_btns.addStretch()

        btn_refresh = QPushButton(_('Refresh'))
        btn_refresh.clicked.connect(self.on_refresh)
        btn_refresh.setFixedHeight(35)
        btn_refresh.setMaximumWidth(80)
        hbox_btns.addWidget(btn_refresh)

        btn_ok = QPushButton(_('OK'))
        btn_ok.setDefault(True)
        btn_ok.clicked.connect(self.on_ok)
        btn_ok.setFixedHeight(35)
        btn_ok.setMaximumWidth(80)
        hbox_btns.addWidget(btn_ok)

        #expires update
        self.timer = parent.idle_timeout(1000, self.update_expire)
        self.timer2 = self.parent.idle_timeout(1000, self.update_image)

        #note: if does not work, use singleShot timer.
        self.entry_input.setFocus(
        )  #call after creating all of the other widgets.

        #Flash if the window is in the background.
        if flash_wnd is not None:
            flash_wnd.flash_taskbar_icon(parent.winId())

        self.exec_()
        self.deleteLater()
コード例 #8
0
ファイル: captcha_gui.py プロジェクト: yckart/ochDownloader
    def __init__(self, service, get_captcha, parent):
        """"""
        QDialog.__init__(self, parent, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
        #self.set_icon(self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU))
        self.setWindowTitle("{service_name} captcha".format(service_name=service))
        self.resize(340, 200)
        
        self.parent = parent
        self.get_captcha = get_captcha
        self.solution = None
        self.timeout = TIMEOUT
        
        vbox = QVBoxLayout()
        vbox.setSpacing(20)
        self.setLayout(vbox)
        
        #captcha image
        #self.image = QPixmap()
        self.label = QLabel()
        self.load_image()
        #self.label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #self.label.setPixmap(self.image)
        vbox.addWidget(self.label)
        
        #input
        hbox_input = QHBoxLayout()
        vbox.addLayout(hbox_input)
        
        self.label_expires = QLabel(_("Expires in") + " {0}".format(self.timeout))
        hbox_input.addWidget(self.label_expires)
        
        self.entry_input = QLineEdit()
        hbox_input.addWidget(self.entry_input)
        
        #buttons
        vbox.addStretch()
        
        hbox_btns = QHBoxLayout()
        vbox.addLayout(hbox_btns)
        
        btn_cancel = QPushButton(_('Cancel'))
        btn_cancel.clicked.connect(self.on_cancel)
        btn_cancel.setFixedHeight(35)
        btn_cancel.setMaximumWidth(80)
        hbox_btns.addWidget(btn_cancel)
        
        hbox_btns.addStretch()
        
        btn_refresh = QPushButton(_('Refresh'))
        btn_refresh.clicked.connect(self.on_refresh)
        btn_refresh.setFixedHeight(35)
        btn_refresh.setMaximumWidth(80)
        hbox_btns.addWidget(btn_refresh)
        
        btn_ok = QPushButton(_('OK'))
        btn_ok.setDefault(True)
        btn_ok.clicked.connect(self.on_ok)
        btn_ok.setFixedHeight(35)
        btn_ok.setMaximumWidth(80)
        hbox_btns.addWidget(btn_ok)
        
        #expires update
        self.timer = parent.idle_timeout(1000, self.expire_update)
        
        #note: if does not work, use singleShot timer.
        self.entry_input.setFocus() #call after creating all of the other widgets.

        #Flash if the window is in the background.
        if cons.OS_WIN:
            flash_wnd.flash_taskbar_icon(parent.winId())
        
        self.exec_()