Example #1
0
    def __init__(self, parent):

        QW.QFrame.__init__(self, parent)

        self.setFrameStyle(QW.QFrame.Box | QW.QFrame.Raised)

        self._network_job = None
        self._download_started = False

        self._auto_override_bandwidth_rules = False

        self._left_text = ClientGUICommon.BetterStaticText(self,
                                                           ellipsize_end=True)
        self._right_text = ClientGUICommon.BetterStaticText(self)
        self._right_text.setAlignment(QC.Qt.AlignRight | QC.Qt.AlignVCenter)

        self._last_right_min_width = 0

        self._gauge = ClientGUICommon.Gauge(self)

        self._cog_button = ClientGUICommon.BetterBitmapButton(
            self,
            CC.global_pixmaps().cog, self._ShowCogMenu)
        self._cancel_button = ClientGUICommon.BetterBitmapButton(
            self,
            CC.global_pixmaps().stop, self.Cancel)

        #

        self._Update()

        #

        st_hbox = QP.HBoxLayout()

        QP.AddToLayout(st_hbox, self._left_text, CC.FLAGS_EXPAND_BOTH_WAYS)
        QP.AddToLayout(st_hbox, self._right_text,
                       CC.FLAGS_CENTER_PERPENDICULAR)

        left_vbox = QP.VBoxLayout()

        QP.AddToLayout(left_vbox, st_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
        QP.AddToLayout(left_vbox, self._gauge, CC.FLAGS_EXPAND_BOTH_WAYS)

        hbox = QP.HBoxLayout()

        QP.AddToLayout(hbox, left_vbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
        QP.AddToLayout(hbox, self._cog_button, CC.FLAGS_CENTER_PERPENDICULAR)
        QP.AddToLayout(hbox, self._cancel_button,
                       CC.FLAGS_CENTER_PERPENDICULAR)

        self.setLayout(hbox)
Example #2
0
    def __init__(self, parent, controller, page_key=None):

        QW.QFrame.__init__(self, parent)

        self.setFrameStyle(QW.QFrame.Box | QW.QFrame.Raised)

        self._controller = controller
        self._page_key = page_key

        self._file_seed_cache = None

        self._import_summary_st = ClientGUICommon.BetterStaticText(
            self, ellipsize_end=True)
        self._progress_st = ClientGUICommon.BetterStaticText(
            self, ellipsize_end=True)

        self._file_seed_cache_button = FileSeedCacheButton(
            self, self._controller, self._GetFileSeedCache)

        self._progress_gauge = ClientGUICommon.Gauge(self)

        #

        self._Update()

        #

        hbox = QP.HBoxLayout()

        QP.AddToLayout(hbox, self._progress_st,
                       CC.FLAGS_CENTER_PERPENDICULAR_EXPAND_DEPTH)
        QP.AddToLayout(hbox, self._file_seed_cache_button,
                       CC.FLAGS_CENTER_PERPENDICULAR)

        vbox = QP.VBoxLayout()

        QP.AddToLayout(vbox, self._import_summary_st,
                       CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
        QP.AddToLayout(vbox, self._progress_gauge,
                       CC.FLAGS_EXPAND_PERPENDICULAR)

        self.setLayout(vbox)

        #

        HG.client_controller.gui.RegisterUIUpdateWindow(self)
    def __init__(self, parent, manager, job_key):

        PopupWindow.__init__(self, parent, manager)

        self.setSizePolicy(QW.QSizePolicy.MinimumExpanding,
                           QW.QSizePolicy.Fixed)

        self._job_key = job_key

        vbox = QP.VBoxLayout()

        self._title = ClientGUICommon.BetterStaticText(self)
        self._title.setAlignment(QC.Qt.AlignHCenter | QC.Qt.AlignVCenter)

        font = self._title.font()
        font.setBold(True)
        self._title.setFont(font)

        popup_message_character_width = HG.client_controller.new_options.GetInteger(
            'popup_message_character_width')

        popup_char_width = ClientGUIFunctions.ConvertTextToPixelWidth(
            self._title, popup_message_character_width)

        if HG.client_controller.new_options.GetBoolean(
                'popup_message_force_min_width'):

            #QP.SetMinClientSize( self, ( wrap_width, -1 ) )
            self.setFixedWidth(popup_char_width)

        else:

            self.setMaximumWidth(popup_char_width)

        self._title.setWordWrap(True)
        self._title_ev = QP.WidgetEventFilter(self._title)
        self._title_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._title.hide()

        self._text_1 = ClientGUICommon.BetterStaticText(self)
        self._text_1.setWordWrap(True)
        self._text_1_ev = QP.WidgetEventFilter(self._text_1)
        self._text_1_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._text_1.hide()

        self._gauge_1 = ClientGUICommon.Gauge(self)
        self._gauge_1_ev = QP.WidgetEventFilter(self._gauge_1)
        self._gauge_1_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._gauge_1.setMinimumWidth(int(popup_char_width * 0.9))
        self._gauge_1.hide()

        self._text_2 = ClientGUICommon.BetterStaticText(self)
        self._text_2.setWordWrap(True)
        self._text_2_ev = QP.WidgetEventFilter(self._text_2)
        self._text_2_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._text_2.hide()

        self._gauge_2 = ClientGUICommon.Gauge(self)
        self._gauge_2_ev = QP.WidgetEventFilter(self._gauge_2)
        self._gauge_2_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._gauge_2.setMinimumWidth(int(popup_char_width * 0.9))
        self._gauge_2.hide()

        self._text_yes_no = ClientGUICommon.BetterStaticText(self)
        self._text_yes_no_ev = QP.WidgetEventFilter(self._text_yes_no)
        self._text_yes_no_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._text_yes_no.hide()

        self._yes = ClientGUICommon.BetterButton(self, 'yes', self._YesButton)
        self._yes.hide()

        self._no = ClientGUICommon.BetterButton(self, 'no', self._NoButton)
        self._no.hide()

        self._network_job_ctrl = ClientGUIControls.NetworkJobControl(self)
        self._network_job_ctrl.hide()

        self._copy_to_clipboard_button = ClientGUICommon.BetterButton(
            self, 'copy to clipboard', self.CopyToClipboard)
        self._copy_to_clipboard_button_ev = QP.WidgetEventFilter(
            self._copy_to_clipboard_button)
        self._copy_to_clipboard_button_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._copy_to_clipboard_button.hide()

        self._show_files_button = ClientGUICommon.BetterButton(
            self, 'show files', self.ShowFiles)
        self._show_files_button_ev = QP.WidgetEventFilter(
            self._show_files_button)
        self._show_files_button_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._show_files_button.hide()

        self._show_tb_button = ClientGUICommon.BetterButton(
            self, 'show traceback', self.ShowTB)
        self._show_tb_button_ev = QP.WidgetEventFilter(self._show_tb_button)
        self._show_tb_button_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._show_tb_button.hide()

        self._tb_text = ClientGUICommon.BetterStaticText(self)
        self._tb_text_ev = QP.WidgetEventFilter(self._tb_text)
        self._tb_text_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._tb_text.setWordWrap(True)
        self._tb_text.hide()

        self._copy_tb_button = ClientGUICommon.BetterButton(
            self, 'copy traceback information', self.CopyTB)
        self._copy_tb_button_ev = QP.WidgetEventFilter(self._copy_tb_button)
        self._copy_tb_button_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._copy_tb_button.hide()

        self._pause_button = ClientGUICommon.BetterBitmapButton(
            self,
            CC.global_pixmaps().pause, self.PausePlay)
        self._pause_button_ev = QP.WidgetEventFilter(self._pause_button)
        self._pause_button_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._pause_button.hide()

        self._cancel_button = ClientGUICommon.BetterBitmapButton(
            self,
            CC.global_pixmaps().stop, self.Cancel)
        self._cancel_button_ev = QP.WidgetEventFilter(self._cancel_button)
        self._cancel_button_ev.EVT_RIGHT_DOWN(self.EventDismiss)
        self._cancel_button.hide()

        hbox = QP.HBoxLayout()

        QP.AddToLayout(hbox, self._pause_button, CC.FLAGS_VCENTER)
        QP.AddToLayout(hbox, self._cancel_button, CC.FLAGS_VCENTER)

        yes_no_hbox = QP.HBoxLayout()

        QP.AddToLayout(yes_no_hbox, self._yes, CC.FLAGS_VCENTER)
        QP.AddToLayout(yes_no_hbox, self._no, CC.FLAGS_VCENTER)

        QP.AddToLayout(vbox, self._title, CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, self._text_1, CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, self._gauge_1, CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, self._text_2, CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, self._gauge_2, CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, self._text_yes_no, CC.FLAGS_EXPAND_PERPENDICULAR)
        QP.AddToLayout(vbox, yes_no_hbox)
        QP.AddToLayout(vbox, self._network_job_ctrl)
        QP.AddToLayout(vbox, self._copy_to_clipboard_button)
        QP.AddToLayout(vbox, self._show_files_button)
        QP.AddToLayout(vbox, self._show_tb_button)
        QP.AddToLayout(vbox, self._tb_text)
        QP.AddToLayout(vbox, self._copy_tb_button)
        QP.AddToLayout(vbox, hbox, CC.FLAGS_BUTTON_SIZER)

        self.setLayout(vbox)