def __init__(self, parent, initial_value=65536):

        wx.Panel.__init__(self, parent)

        self._spin = wx.SpinCtrl(self, min=0, max=1048576)

        width = ClientGUICommon.ConvertTextToPixelWidth(self._spin, 12)

        self._spin.SetSize((width, -1))

        self._unit = ClientGUICommon.BetterChoice(self)

        self._unit.Append('B', 1)
        self._unit.Append('KB', 1024)
        self._unit.Append('MB', 1024 * 1024)
        self._unit.Append('GB', 1024 * 1024 * 1024)

        #

        self.SetValue(initial_value)

        #

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(self._spin, CC.FLAGS_VCENTER)
        hbox.Add(self._unit, CC.FLAGS_VCENTER)

        self.SetSizer(hbox)
Beispiel #2
0
    def __init__(self,
                 parent,
                 name,
                 height_num_chars,
                 sizing_column_initial_width_num_chars,
                 columns,
                 data_to_tuples_func,
                 delete_key_callback=None,
                 activation_callback=None):

        wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT)
        ListCtrlAutoWidthMixin.__init__(self)

        self._data_to_tuples_func = data_to_tuples_func

        self._sort_column = 0
        self._sort_asc = True

        # eventually have it look up 'name' in some options somewhere and see previous height, width, and column selection
        # this thing should deal with missing entries but also have some filtered defaults for subs listctrl, which will have a bunch of possible columns

        self._indices_to_data_info = {}
        self._data_to_indices = {}

        (total_width, height) = ClientGUICommon.ConvertTextToPixels(
            self, (sizing_column_initial_width_num_chars, height_num_chars))

        resize_column = 1

        for (i, (name, width_num_chars)) in enumerate(columns):

            if width_num_chars == -1:

                width = -1

                resize_column = i + 1

            else:

                width = ClientGUICommon.ConvertTextToPixelWidth(
                    self, width_num_chars)

                total_width += width

            self.InsertColumn(i, name, width=width)

        self.setResizeColumn(resize_column)

        self.SetInitialSize((total_width, height))

        self._delete_key_callback = delete_key_callback
        self._activation_callback = activation_callback

        self.Bind(wx.EVT_KEY_DOWN, self.EventKeyDown)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.EventItemActivated)

        self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.EventBeginColDrag)
        self.Bind(wx.EVT_LIST_COL_CLICK, self.EventColumnClick)
    def __init__(self, parent, payload_objs):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_objs = payload_objs

        self._directory_picker = wx.DirPickerCtrl(self)

        dp_width = ClientGUICommon.ConvertTextToPixelWidth(
            self._directory_picker, 52)

        self._directory_picker.SetMinSize((dp_width, -1))

        self._width = wx.SpinCtrl(self, min=100, max=4096)

        self._export = ClientGUICommon.BetterButton(self, 'export',
                                                    self.Export)

        #

        last_png_export_dir = HG.client_controller.new_options.GetNoneableString(
            'last_png_export_dir')

        if last_png_export_dir is not None:

            self._directory_picker.SetPath(last_png_export_dir)

        self._width.SetValue(512)

        self._Update()

        #

        rows = []

        rows.append(('export path: ', self._directory_picker))
        rows.append(('png width: ', self._width))
        rows.append(('', self._export))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        self.SetSizer(gridbox)

        self._directory_picker.Bind(wx.EVT_DIRPICKER_CHANGED,
                                    self.EventChanged)
Beispiel #4
0
 def ShowTB( self ):
     
     if self._tb_text.IsShown():
         
         self._show_tb_button.SetLabelText( 'show traceback' )
         
         self._tb_text.Hide()
         
     else:
         
         self._show_tb_button.SetLabelText( 'hide traceback' )
         
         popup_message_character_width = HG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
         
         wrap_width = ClientGUICommon.ConvertTextToPixelWidth( self._title, popup_message_character_width )
         
         self._tb_text.Show()
         
     
     self.GetParent().MakeSureEverythingFits()
Beispiel #5
0
 def __init__( self, parent, job_key ):
     
     PopupWindow.__init__( self, parent )
     
     self._job_key = job_key
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     self._title = ClientGUICommon.BetterStaticText( self, style = wx.ALIGN_CENTER )
     
     popup_message_character_width = HG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
     
     wrap_width = ClientGUICommon.ConvertTextToPixelWidth( self._title, popup_message_character_width )
     
     if HG.client_controller.new_options.GetBoolean( 'popup_message_force_min_width' ):
         
         self.SetMinClientSize( ( wrap_width, -1 ) )
         
     
     self._title.SetWrapWidth( wrap_width )
     self._title.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._title.Hide()
     
     self._text_1 = ClientGUICommon.BetterStaticText( self )
     self._text_1.SetWrapWidth( wrap_width )
     self._text_1.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_1.Hide()
     
     self._gauge_1 = ClientGUICommon.Gauge( self, size = ( wrap_width, -1 ) )
     self._gauge_1.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._gauge_1.Hide()
     
     self._text_2 = ClientGUICommon.BetterStaticText( self )
     self._text_2.SetWrapWidth( wrap_width )
     self._text_2.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_2.Hide()
     
     self._gauge_2 = ClientGUICommon.Gauge( self, size = ( wrap_width, -1 ) )
     self._gauge_2.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._gauge_2.Hide()
     
     self._text_yes_no = ClientGUICommon.BetterStaticText( self )
     self._text_yes_no.SetWrapWidth( wrap_width )
     self._text_yes_no.Bind( wx.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.Bind( wx.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.Bind( wx.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.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._show_tb_button.Hide()
     
     self._tb_text = ClientGUICommon.BetterStaticText( self )
     self._tb_text.SetWrapWidth( wrap_width )
     self._tb_text.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._tb_text.Hide()
     
     self._copy_tb_button = ClientGUICommon.BetterButton( self, 'copy traceback information', self.CopyTB )
     self._copy_tb_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._copy_tb_button.Hide()
     
     self._pause_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.pause, self.PausePlay )
     self._pause_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._pause_button.Hide()
     
     self._cancel_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.stop, self.Cancel )
     self._cancel_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._cancel_button.Hide()
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( self._pause_button, CC.FLAGS_VCENTER )
     hbox.Add( self._cancel_button, CC.FLAGS_VCENTER )
     
     yes_no_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     yes_no_hbox.Add( self._yes, CC.FLAGS_VCENTER )
     yes_no_hbox.Add( self._no, CC.FLAGS_VCENTER )
     
     vbox.Add( self._title, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._gauge_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._gauge_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_yes_no, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( yes_no_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.Add( self._network_job_ctrl, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._copy_to_clipboard_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._show_files_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._show_tb_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._tb_text, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._copy_tb_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( hbox, CC.FLAGS_BUTTON_SIZER )
     
     self.SetSizer( vbox )
Beispiel #6
0
 def _SizeAndPositionAndShow( self ):
     
     try:
         
         parent = self.GetParent()
         
         # changing show status while parent iconised in Windows leads to grey window syndrome
         windows_and_iconised = HC.PLATFORM_WINDOWS and parent.IsIconized()
         
         possibly_on_hidden_virtual_desktop = not ClientGUITopLevelWindows.MouseIsOnMyDisplay( parent )
         
         going_to_bug_out_at_hide_or_show = windows_and_iconised or possibly_on_hidden_virtual_desktop
         
         current_focus_tlp = wx.GetTopLevelParent( wx.Window.FindFocus() )
         
         main_gui_is_active = current_focus_tlp in ( self, parent )
         
         on_top_frame_is_active = False
         
         if not main_gui_is_active:
             
             c_f_tlp_is_child_frame_of_main_gui = isinstance( current_focus_tlp, wx.Frame ) and current_focus_tlp.GetParent() == parent
             
             if c_f_tlp_is_child_frame_of_main_gui and current_focus_tlp.GetWindowStyle() & wx.FRAME_FLOAT_ON_PARENT == wx.FRAME_FLOAT_ON_PARENT:
                 
                 on_top_frame_is_active = True
                 
             
         
         num_messages_displayed = self._message_vbox.GetItemCount()
         
         there_is_stuff_to_display = num_messages_displayed > 0
         
         if there_is_stuff_to_display:
             
             # little catch here to try to stop the linux users who got infinitely expanding popups wew
             
             popup_message_character_width = HG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
             
             wrap_width = ClientGUICommon.ConvertTextToPixelWidth( self, popup_message_character_width )
             
             max_width = wrap_width * 1.2
             
             ( best_width, best_height ) = self.GetBestSize()
             
             best_width = min( best_width, max_width )
             
             best_size = ( best_width, best_height )
             
             if best_size != self._last_best_size_i_fit_on:
                 
                 self._last_best_size_i_fit_on = best_size
                 
                 self.SetClientSize( best_size )
                 
                 self.Layout()
                 
             
             ( parent_width, parent_height ) = parent.GetClientSize()
             
             ( my_width, my_height ) = self.GetClientSize()
             
             my_x = ( parent_width - my_width ) - 25
             my_y = ( parent_height - my_height ) - 5
             
             if parent.IsShown():
                 
                 my_position = ClientGUICommon.ClientToScreen( parent, ( my_x, my_y ) )
                 
                 if my_position != self.GetPosition():
                     
                     self.SetPosition( my_position )
                     
                 
             
             # Unhiding tends to raise the main gui tlp, which is annoying if a media viewer window has focus
             show_is_not_annoying = main_gui_is_active or on_top_frame_is_active or self._DisplayingError()
             
             ok_to_show = show_is_not_annoying and not going_to_bug_out_at_hide_or_show
             
             if ok_to_show:
                 
                 was_hidden = not self.IsShown()
                 
                 self.Show()
                 
                 if was_hidden:
                     
                     self.Layout()
                     
                     self.Refresh()
                     
                 
             
         else:
             
             if not going_to_bug_out_at_hide_or_show:
                 
                 self.Hide()
                 
             
         
     except:
         
         text = 'The popup message manager experienced a fatal error and will now stop working! Please restart the client as soon as possible! If this keeps happening, please email the details and your client.log to the hydrus developer.'
         
         HydrusData.Print( text )
         
         HydrusData.Print( traceback.format_exc() )
         
         wx.MessageBox( text )
         
         self._update_job.Cancel()
         
         self.CleanBeforeDestroy()
         
         self.DestroyLater()
Beispiel #7
0
 def UpdateMessage( self ):
     
     popup_message_character_width = HG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
     
     wrap_width = ClientGUICommon.ConvertTextToPixelWidth( self._title, popup_message_character_width )
     
     paused = self._job_key.IsPaused()
     
     title = self._job_key.GetIfHasVariable( 'popup_title' )
     
     if title is not None:
         
         self._title.Show()
         
         self._title.SetLabelText( title )
         
     else:
         
         self._title.Hide()
         
     
     popup_text_1 = self._job_key.GetIfHasVariable( 'popup_text_1' )
     
     if popup_text_1 is not None or paused:
         
         if paused:
             
             text = 'paused'
             
         else:
             
             text = popup_text_1
             
         
         self._text_1.Show()
         
         self._text_1.SetLabelText( text )
         
     else:
         
         self._text_1.Hide()
         
     
     popup_gauge_1 = self._job_key.GetIfHasVariable( 'popup_gauge_1' )
     
     if popup_gauge_1 is not None and not paused:
         
         ( gauge_value, gauge_range ) = popup_gauge_1
         
         self._gauge_1.SetRange( gauge_range )
         self._gauge_1.SetValue( gauge_value )
         
         self._gauge_1.Show()
         
     else:
         
         self._gauge_1.Hide()
         
     
     popup_text_2 = self._job_key.GetIfHasVariable( 'popup_text_2' )
     
     if popup_text_2 is not None and not paused:
         
         text = popup_text_2
         
         self._text_2.SetLabelText( self._ProcessText( HydrusData.ToUnicode( text ) ) )
         
         self._text_2.Show()
         
     else:
         
         self._text_2.Hide()
         
     
     popup_gauge_2 = self._job_key.GetIfHasVariable( 'popup_gauge_2' )
     
     if popup_gauge_2 is not None and not paused:
         
         ( gauge_value, gauge_range ) = popup_gauge_2
         
         self._gauge_2.SetRange( gauge_range )
         self._gauge_2.SetValue( gauge_value )
         
         self._gauge_2.Show()
         
     else:
         
         self._gauge_2.Hide()
         
     
     popup_yes_no_question = self._job_key.GetIfHasVariable( 'popup_yes_no_question' )
     
     if popup_yes_no_question is not None and not paused:
         
         text = popup_yes_no_question
         
         if self._text_yes_no.GetLabelText() != text:
             
             self._text_yes_no.SetLabelText( self._ProcessText( HydrusData.ToUnicode( text ) ) )
             
         
         self._text_yes_no.Show()
         
         self._yes.Show()
         self._no.Show()
         
     else:
         
         self._text_yes_no.Hide()
         self._yes.Hide()
         self._no.Hide()
         
     
     if self._job_key.HasVariable( 'popup_network_job' ):
         
         # this can be validly None, which confuses the getifhas result
         
         popup_network_job = self._job_key.GetIfHasVariable( 'popup_network_job' )
         
         self._network_job_ctrl.SetNetworkJob( popup_network_job )
         
         self._network_job_ctrl.Show()
         
     else:
         
         self._network_job_ctrl.ClearNetworkJob()
         
         self._network_job_ctrl.Hide()
         
     
     popup_clipboard = self._job_key.GetIfHasVariable( 'popup_clipboard' )
     
     if popup_clipboard is not None:
         
         ( title, text ) = popup_clipboard
         
         if self._copy_to_clipboard_button.GetLabelText() != title:
             
             self._copy_to_clipboard_button.SetLabelText( title )
             
         
         self._copy_to_clipboard_button.Show()
         
     else:
         
         self._copy_to_clipboard_button.Hide()
         
     
     result = self._job_key.GetIfHasVariable( 'popup_files' )
     
     if result is not None:
         
         ( popup_files, popup_files_name ) = result
         
         hashes = popup_files
         
         text = popup_files_name + ' - show ' + HydrusData.ToHumanInt( len( hashes ) ) + ' files'
         
         if self._show_files_button.GetLabelText() != text:
             
             self._show_files_button.SetLabelText( text )
             
         
         self._show_files_button.Show()
         
     else:
         
         self._show_files_button.Hide()
         
     
     popup_traceback = self._job_key.GetIfHasVariable( 'popup_traceback' )
     
     if popup_traceback is not None:
         
         self._copy_tb_button.Show()
         
     else:
         
         self._copy_tb_button.Hide()
         
     
     if popup_traceback is not None:
         
         text = popup_traceback
         
         if self._tb_text.GetLabelText() != text:
             
             self._tb_text.SetLabelText( self._ProcessText( HydrusData.ToUnicode( text ) ) )
             
         
         self._show_tb_button.Show()
         
     else:
         
         self._show_tb_button.Hide()
         self._tb_text.Hide()
         
     
     if self._job_key.IsPausable():
         
         self._pause_button.Show()
         
     else:
         
         self._pause_button.Hide()
         
     
     if self._job_key.IsCancellable():
         
         self._cancel_button.Show()
         
     else:
         
         self._cancel_button.Hide()
    def __init__(self,
                 parent,
                 payload_obj,
                 title=None,
                 description=None,
                 payload_description=None):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_obj = payload_obj

        self._filepicker = wx.FilePickerCtrl(self,
                                             style=wx.FLP_SAVE
                                             | wx.FLP_USE_TEXTCTRL,
                                             wildcard='PNG (*.png)|*.png')

        flp_width = ClientGUICommon.ConvertTextToPixelWidth(
            self._filepicker, 64)

        self._filepicker.SetMinSize((flp_width, -1))

        self._title = wx.TextCtrl(self)

        self._payload_description = wx.TextCtrl(self)

        self._text = wx.TextCtrl(self)

        self._width = wx.SpinCtrl(self, min=100, max=4096)

        self._export = ClientGUICommon.BetterButton(self, 'export',
                                                    self.Export)

        #

        if payload_description is None:

            (payload_description, payload_string
             ) = ClientSerialisable.GetPayloadDescriptionAndString(
                 self._payload_obj)

        else:

            payload_string = ClientSerialisable.GetPayloadString(
                self._payload_obj)

            payload_description += ' - ' + HydrusData.ConvertIntToBytes(
                len(payload_string))

        self._payload_description.SetValue(payload_description)

        self._payload_description.Disable()

        self._width.SetValue(512)

        last_png_export_dir = HG.client_controller.new_options.GetNoneableString(
            'last_png_export_dir')

        if title is not None:

            name = title

        elif isinstance(self._payload_obj,
                        HydrusSerialisable.SerialisableBaseNamed):

            name = self._payload_obj.GetName()

        else:

            name = payload_description

        self._title.SetValue(name)

        if description is not None:

            self._text.SetValue(description)

        if last_png_export_dir is not None:

            filename = name + '.png'

            filename = HydrusPaths.SanitizeFilename(filename)

            path = os.path.join(last_png_export_dir, filename)

            self._filepicker.SetPath(path)

        self._Update()

        #

        rows = []

        rows.append(('export path: ', self._filepicker))
        rows.append(('title: ', self._title))
        rows.append(('payload description: ', self._payload_description))
        rows.append(('your description (optional): ', self._text))
        rows.append(('png width: ', self._width))
        rows.append(('', self._export))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        self.SetSizer(gridbox)

        self._filepicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.EventChanged)
        self._title.Bind(wx.EVT_TEXT, self.EventChanged)
    def __init__(self, parent):

        wx.Panel.__init__(self, parent, style=wx.BORDER_DOUBLE)

        self._network_job = None
        self._download_started = False

        self._auto_override_bandwidth_rules = False

        self._left_text = ClientGUICommon.BetterStaticText(self)
        self._right_text = ClientGUICommon.BetterStaticText(
            self, style=wx.ALIGN_RIGHT)

        # 512/768KB - 200KB/s
        right_width = ClientGUICommon.ConvertTextToPixelWidth(
            self._right_text, 20)

        self._right_text.SetMinSize((right_width, -1))

        self._gauge = ClientGUICommon.Gauge(self)

        menu_items = []

        invert_call = self.FlipOverrideBandwidthForCurrentJob
        value_call = self.CurrentJobOverridesBandwidth

        check_manager = ClientGUICommon.CheckboxManagerCalls(
            invert_call, value_call)

        menu_items.append((
            'check', 'override bandwidth rules for this job',
            'Tell the current job to ignore existing bandwidth rules and go ahead anyway.',
            check_manager))

        menu_items.append(('separator', 0, 0, 0))

        invert_call = self.FlipAutoOverrideBandwidth
        value_call = self.AutoOverrideBandwidth

        check_manager = ClientGUICommon.CheckboxManagerCalls(
            invert_call, value_call)

        menu_items.append((
            'check',
            'auto-override bandwidth rules for all jobs here after five seconds',
            'Ignore existing bandwidth rules for all jobs under this control, instead waiting a flat five seconds.',
            check_manager))

        self._cog_button = ClientGUICommon.MenuBitmapButton(
            self, CC.GlobalBMPs.cog, menu_items)
        self._cancel_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.stop, self.Cancel)

        #

        self._Update()

        #

        st_hbox = wx.BoxSizer(wx.HORIZONTAL)

        st_hbox.Add(self._left_text, CC.FLAGS_EXPAND_BOTH_WAYS)
        st_hbox.Add(self._right_text, CC.FLAGS_VCENTER)

        left_vbox = wx.BoxSizer(wx.VERTICAL)

        left_vbox.Add(st_hbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
        left_vbox.Add(self._gauge, CC.FLAGS_EXPAND_PERPENDICULAR)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(left_vbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
        hbox.Add(self._cog_button, CC.FLAGS_VCENTER)
        hbox.Add(self._cancel_button, CC.FLAGS_VCENTER)

        self.SetSizer(hbox)
Beispiel #10
0
 def _Update( self ):
     
     if self._network_job is None or self._network_job.NoEngineYet():
         
         self._left_text.SetLabelText( '' )
         self._right_text.SetLabelText( '' )
         self._gauge.SetRange( 1 )
         self._gauge.SetValue( 0 )
         
         can_cancel = False
         
     else:
         
         if self._network_job.IsDone():
             
             can_cancel = False
             
         else:
             
             can_cancel = True
             
         
         ( status_text, current_speed, bytes_read, bytes_to_read ) = self._network_job.GetStatus()
         
         self._left_text.SetLabelText( status_text )
         
         if not self._download_started and current_speed > 0:
             
             self._download_started = True
             
         
         speed_text = ''
         
         if self._download_started and not self._network_job.HasError():
             
             if bytes_read is not None:
                 
                 if bytes_to_read is not None and bytes_read != bytes_to_read:
                     
                     speed_text += HydrusData.ConvertValueRangeToBytes( bytes_read, bytes_to_read )
                     
                 else:
                     
                     speed_text += HydrusData.ConvertIntToBytes( bytes_read )
                     
                 
             
             if current_speed != bytes_to_read: # if it is a real quick download, just say its size
                 
                 speed_text += ' ' + HydrusData.ConvertIntToBytes( current_speed ) + '/s'
                 
             
         
         self._right_text.SetLabelText( speed_text )
         
         right_width = ClientGUICommon.ConvertTextToPixelWidth( self._right_text, len( speed_text ) )
         
         right_min_size = ( right_width, -1 )
         
         if right_min_size != self._last_right_min_width:
             
             self._last_right_min_width = right_min_size
             
             self._right_text.SetMinSize( right_min_size )
             
             self.Layout()
             
         
         self._gauge.SetRange( bytes_to_read )
         self._gauge.SetValue( bytes_read )
         
     
     if can_cancel:
         
         if not self._cancel_button.IsEnabled():
             
             self._cancel_button.Enable()
             
         
     else:
         
         if self._cancel_button.IsEnabled():
             
             self._cancel_button.Disable()