Exemplo n.º 1
0
 def __init__( self, parent, dictionary ):
     
     ClientGUICommon.StaticBox.__init__( self, parent, 'file repository' )
     
     self._log_uploader_ips = wx.CheckBox( self )
     self._max_storage = ClientGUICommon.NoneableSpinCtrl( self, unit = 'MB', multiplier = 1024 * 1024 )
     
     #
     
     log_uploader_ips = dictionary[ 'log_uploader_ips' ]
     max_storage = dictionary[ 'max_storage' ]
     
     self._log_uploader_ips.SetValue( log_uploader_ips )
     self._max_storage.SetValue( max_storage )
     
     #
     
     rows = []
     
     rows.append( ( 'log file uploader IP addresses?: ', self._log_uploader_ips ) )
     rows.append( ( 'max file storage: ', self._max_storage ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self, rows )
     
     self.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
Exemplo n.º 2
0
    def __init__(self, parent, payload_objs):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_objs = payload_objs

        self._directory_picker = wx.DirPickerCtrl(self)
        self._directory_picker.Bind(wx.EVT_DIRPICKER_CHANGED,
                                    self.EventChanged)

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

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

        #

        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)
Exemplo n.º 3
0
    def __init__(self, parent, payload_obj):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_obj = payload_obj

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

        self._title = wx.TextCtrl(self)
        self._title.Bind(wx.EVT_TEXT, self.EventChanged)

        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)

        #

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

        self._payload_description.SetValue(payload_description)

        self._payload_description.Disable()

        self._width.SetValue(512)

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

            self._title.SetValue(self._payload_obj.GetName())

        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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
        def __init__(self, parent, services, media):

            wx.Panel.__init__(self, parent)

            self._services = services

            self._media = media

            self._service_keys_to_controls = {}
            self._service_keys_to_original_ratings_states = {}

            rows = []

            for service in self._services:

                name = service.GetName()

                service_key = service.GetServiceKey()

                (rating_state,
                 rating) = ClientRatings.GetNumericalStateFromMedia(
                     self._media, service_key)

                control = ClientGUICommon.RatingNumericalDialog(
                    self, service_key)

                if rating_state != ClientRatings.SET:

                    control.SetRatingState(rating_state)

                else:

                    control.SetRating(rating)

                self._service_keys_to_controls[service_key] = control
                self._service_keys_to_original_ratings_states[service_key] = (
                    rating_state, rating)

                rows.append((name + ': ', control))

            gridbox = ClientGUICommon.WrapInGrid(self, rows, expand_text=True)

            self.SetSizer(gridbox)
Exemplo n.º 6
0
        def __init__(self, parent, services, media):

            wx.Panel.__init__(self, parent)

            self.SetBackgroundColour(
                wx.SystemSettings.GetColour(wx.SYS_COLOUR_FRAMEBK))

            self._services = services

            self._media = media

            self._service_keys_to_controls = {}
            self._service_keys_to_original_ratings_states = {}

            rows = []

            for service in self._services:

                name = service.GetName()

                service_key = service.GetServiceKey()

                rating_state = ClientRatings.GetLikeStateFromMedia(
                    self._media, service_key)

                control = ClientGUICommon.RatingLikeDialog(self, service_key)

                control.SetRatingState(rating_state)

                self._service_keys_to_controls[service_key] = control
                self._service_keys_to_original_ratings_states[
                    service_key] = rating_state

                rows.append((name + ': ', control))

            gridbox = ClientGUICommon.WrapInGrid(self, rows, expand_text=True)

            self.SetSizer(gridbox)
Exemplo n.º 7
0
 def __init__( self, parent, name, port, dictionary ):
     
     ClientGUICommon.StaticBox.__init__( self, parent, 'basic information' )
     
     self._name = wx.TextCtrl( self )
     self._port = wx.SpinCtrl( self, min = 1, max = 65535 )
     self._upnp_port = ClientGUICommon.NoneableSpinCtrl( self, 'external upnp port', none_phrase = 'do not forward port', min = 1, max = 65535 )
     
     self._bandwidth_tracker_st = wx.StaticText( self )
     
     #
     
     self._name.SetValue( name )
     self._port.SetValue( port )
     
     upnp_port = dictionary[ 'upnp_port' ]
     
     self._upnp_port.SetValue( upnp_port )
     
     bandwidth_tracker = dictionary[ 'bandwidth_tracker' ]
     
     bandwidth_text = bandwidth_tracker.GetCurrentMonthSummary()
     
     self._bandwidth_tracker_st.SetLabelText( bandwidth_text )
     
     #
     
     rows = []
     
     rows.append( ( 'name: ', self._name ) )
     rows.append( ( 'port: ', self._port ) )
     rows.append( ( 'upnp port: ', self._upnp_port ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self, rows )
     
     self.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     self.AddF( self._bandwidth_tracker_st, CC.FLAGS_EXPAND_PERPENDICULAR )
Exemplo n.º 8
0
    def __init__(self, parent, export_folder):

        ClientGUIScrolledPanels.EditPanel.__init__(self, parent)

        self._export_folder = export_folder

        (name, path, export_type, delete_from_client_after_export,
         file_search_context, period, phrase) = self._export_folder.ToTuple()

        self._path_box = ClientGUICommon.StaticBox(self, 'name and location')

        self._name = wx.TextCtrl(self._path_box)

        self._path = wx.DirPickerCtrl(self._path_box,
                                      style=wx.DIRP_USE_TEXTCTRL)

        #

        self._type_box = ClientGUICommon.StaticBox(self, 'type of export')

        self._type = ClientGUICommon.BetterChoice(self._type_box)
        self._type.Append('regular', HC.EXPORT_FOLDER_TYPE_REGULAR)
        self._type.Append('synchronise', HC.EXPORT_FOLDER_TYPE_SYNCHRONISE)

        self._delete_from_client_after_export = wx.CheckBox(self._type_box)

        #

        self._query_box = ClientGUICommon.StaticBox(self, 'query to export')

        self._page_key = 'export folders placeholder'

        predicates = file_search_context.GetPredicates()

        self._predicates_box = ClientGUIListBoxes.ListBoxTagsActiveSearchPredicates(
            self._query_box, self._page_key, predicates)

        self._searchbox = ClientGUIACDropdown.AutoCompleteDropdownTagsRead(
            self._query_box, self._page_key, file_search_context)

        #

        self._period_box = ClientGUICommon.StaticBox(self, 'export period')

        self._period = ClientGUITime.TimeDeltaButton(self._period_box,
                                                     min=3 * 60,
                                                     days=True,
                                                     hours=True,
                                                     minutes=True)

        #

        self._phrase_box = ClientGUICommon.StaticBox(self, 'filenames')

        self._pattern = wx.TextCtrl(self._phrase_box)

        self._examples = ClientGUICommon.ExportPatternButton(self._phrase_box)

        #

        self._name.SetValue(name)

        self._path.SetPath(path)

        self._type.SelectClientData(export_type)

        self._delete_from_client_after_export.SetValue(
            delete_from_client_after_export)

        self._period.SetValue(period)

        self._pattern.SetValue(phrase)

        #

        rows = []

        rows.append(('name: ', self._name))
        rows.append(('folder path: ', self._path))

        gridbox = ClientGUICommon.WrapInGrid(self._path_box, rows)

        self._path_box.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)

        #

        text = '''regular - try to export the files to the directory, overwriting if the filesize if different

synchronise - try to export the files to the directory, overwriting if the filesize if different, and delete anything else in the directory

If you select synchronise, be careful!'''

        st = ClientGUICommon.BetterStaticText(self._type_box, label=text)

        st.SetWrapWidth(440)

        self._type_box.Add(st, CC.FLAGS_EXPAND_PERPENDICULAR)
        self._type_box.Add(self._type, CC.FLAGS_EXPAND_PERPENDICULAR)

        rows = []

        rows.append(('delete files from client after export: ',
                     self._delete_from_client_after_export))

        gridbox = ClientGUICommon.WrapInGrid(self._type_box, rows)

        self._type_box.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)

        self._query_box.Add(self._predicates_box, CC.FLAGS_EXPAND_BOTH_WAYS)
        self._query_box.Add(self._searchbox, CC.FLAGS_EXPAND_PERPENDICULAR)

        self._period_box.Add(self._period, CC.FLAGS_EXPAND_PERPENDICULAR)

        phrase_hbox = wx.BoxSizer(wx.HORIZONTAL)

        phrase_hbox.Add(self._pattern, CC.FLAGS_EXPAND_BOTH_WAYS)
        phrase_hbox.Add(self._examples, CC.FLAGS_VCENTER)

        self._phrase_box.Add(phrase_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.Add(self._path_box, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.Add(self._type_box, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.Add(self._query_box, CC.FLAGS_EXPAND_BOTH_WAYS)
        vbox.Add(self._period_box, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.Add(self._phrase_box, CC.FLAGS_EXPAND_PERPENDICULAR)

        self.SetSizer(vbox)

        self._UpdateTypeDeleteUI()

        self._type.Bind(wx.EVT_CHOICE, self.EventTypeChoice)
        self._delete_from_client_after_export.Bind(
            wx.EVT_CHECKBOX, self.EventDeleteFilesAfterExport)
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
 def __init__( self, parent, subscription ):
     
     subscription = subscription.Duplicate()
     
     ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
     
     self._original_subscription = subscription
     
     #
     
     self._name = wx.TextCtrl( self )
     
     #
     
     self._info_panel = ClientGUICommon.StaticBox( self, 'info' )
     
     self._last_checked_st = wx.StaticText( self._info_panel )
     self._next_check_st = wx.StaticText( self._info_panel )
     self._seed_info_st = wx.StaticText( self._info_panel )
     
     #
     
     self._query_panel = ClientGUICommon.StaticBox( self, 'site and query' )
     
     self._site_type = ClientGUICommon.BetterChoice( self._query_panel )
     
     site_types = []
     site_types.append( HC.SITE_TYPE_BOORU )
     site_types.append( HC.SITE_TYPE_DEVIANT_ART )
     site_types.append( HC.SITE_TYPE_HENTAI_FOUNDRY_ARTIST )
     site_types.append( HC.SITE_TYPE_HENTAI_FOUNDRY_TAGS )
     site_types.append( HC.SITE_TYPE_NEWGROUNDS )
     site_types.append( HC.SITE_TYPE_PIXIV_ARTIST_ID )
     site_types.append( HC.SITE_TYPE_PIXIV_TAG )
     site_types.append( HC.SITE_TYPE_TUMBLR )
     
     for site_type in site_types:
         
         self._site_type.Append( HC.site_type_string_lookup[ site_type ], site_type )
         
     
     self._site_type.Bind( wx.EVT_CHOICE, self.EventSiteChanged )
     
     self._query = wx.TextCtrl( self._query_panel )
     
     self._booru_selector = wx.ListBox( self._query_panel )
     self._booru_selector.Bind( wx.EVT_LISTBOX, self.EventBooruSelected )
     
     self._period = ClientGUICommon.TimeDeltaButton( self._query_panel, min = 3600 * 4, days = True, hours = True )
     self._period.Bind( ClientGUICommon.EVT_TIME_DELTA, self.EventPeriodChanged )
     
     #
     
     self._options_panel = ClientGUICommon.StaticBox( self, 'options' )
     
     menu_items = []
     
     invert_call = self._InvertGetTagsIfURLKnownAndFileRedundant
     value_call = self._GetTagsIfURLKnownAndFileRedundant
     
     check_manager = ClientGUICommon.CheckboxManagerCalls( invert_call, value_call )
     
     menu_items.append( ( 'check', 'get tags even if url is known and file is already in db (this downloader)', 'If this is selected, the client will fetch the tags from a file\'s page even if it has the file and already previously downloaded it from that location.', check_manager ) )
     
     menu_items.append( ( 'separator', 0, 0, 0 ) )
     
     check_manager = ClientGUICommon.CheckboxManagerOptions( 'get_tags_if_url_known_and_file_redundant' )
     
     menu_items.append( ( 'check', 'get tags even if url is known and file is already in db (default)', 'Set the default for this value.', check_manager ) )
     
     cog_button = ClientGUICommon.MenuBitmapButton( self._options_panel, CC.GlobalBMPs.cog, menu_items )
     
     self._initial_file_limit = ClientGUICommon.NoneableSpinCtrl( self._options_panel, '', none_phrase = 'get everything', min = 1, max = 1000000 )
     self._initial_file_limit.SetToolTipString( 'If set, the first sync will add no more than this many files. Otherwise, it will get everything the gallery has.' )
     
     self._periodic_file_limit = ClientGUICommon.NoneableSpinCtrl( self._options_panel, '', none_phrase = 'get everything', min = 1, max = 1000000 )
     self._periodic_file_limit.SetToolTipString( 'If set, normal syncs will add no more than this many files. Otherwise, they will get everything up until they find a file they have seen before.' )
     
     #
     
     self._control_panel = ClientGUICommon.StaticBox( self, 'control' )
     
     self._paused = wx.CheckBox( self._control_panel )
     
     self._seed_cache_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.seed_cache, self._SeedCache )
     self._seed_cache_button.SetToolTipString( 'open detailed url cache status' )
     
     self._retry_failed = ClientGUICommon.BetterButton( self._control_panel, 'retry failed', self.RetryFailed )
     
     self._check_now_button = ClientGUICommon.BetterButton( self._control_panel, 'force check on dialog ok', self.CheckNow )
     
     self._reset_cache_button = ClientGUICommon.BetterButton( self._control_panel, 'reset url cache', self.ResetCache )
     
     #
     
     self._import_tag_options = ClientGUICollapsible.CollapsibleOptionsTags( self )
     
     self._import_file_options = ClientGUICollapsible.CollapsibleOptionsImportFiles( self )
     
     #
     
     ( name, gallery_identifier, gallery_stream_identifiers, query, period, self._get_tags_if_url_known_and_file_redundant, initial_file_limit, periodic_file_limit, paused, import_file_options, import_tag_options, self._last_checked, self._last_error, self._check_now, self._seed_cache ) = subscription.ToTuple()
     
     self._name.SetValue( name )
     
     site_type = gallery_identifier.GetSiteType()
     
     self._site_type.SelectClientData( site_type )
     
     self._PresentForSiteType()
     
     if site_type == HC.SITE_TYPE_BOORU:
         
         booru_name = gallery_identifier.GetAdditionalInfo()
         
         index = self._booru_selector.FindString( booru_name )
         
         if index != wx.NOT_FOUND:
             
             self._booru_selector.Select( index )
             
         
     
     # set gallery_stream_identifiers selection here--some kind of list of checkboxes or whatever
     
     self._query.SetValue( query )
     
     self._period.SetValue( period )
     
     self._initial_file_limit.SetValue( initial_file_limit )
     self._periodic_file_limit.SetValue( periodic_file_limit )
     
     self._paused.SetValue( paused )
     
     self._import_file_options.SetOptions( import_file_options )
     
     self._import_tag_options.SetOptions( import_tag_options )
     
     if self._last_checked == 0:
         
         self._reset_cache_button.Disable()
         
     
     if self._check_now:
         
         self._check_now_button.Disable()
         
     
     self._UpdateCommandButtons()
     self._UpdateLastNextCheck()
     self._UpdateSeedInfo()
     
     #
     
     self._info_panel.AddF( self._last_checked_st, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._info_panel.AddF( self._next_check_st, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._info_panel.AddF( self._seed_info_st, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'search text: ', self._query ) )
     rows.append( ( 'check for new files every: ', self._period ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._query_panel, rows )
     
     self._query_panel.AddF( self._site_type, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._query_panel.AddF( self._booru_selector, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._query_panel.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'on first check, get at most this many files: ', self._initial_file_limit ) )
     rows.append( ( 'on normal checks, get at most this many newer files: ', self._periodic_file_limit ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._options_panel, rows )
     
     self._options_panel.AddF( cog_button, CC.FLAGS_LONE_BUTTON )
     self._options_panel.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     self._control_panel.AddF( self._seed_cache_button, CC.FLAGS_LONE_BUTTON )
     
     rows = []
     
     rows.append( ( 'currently paused: ', self._paused ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._control_panel, rows )
     
     self._control_panel.AddF( gridbox, CC.FLAGS_LONE_BUTTON )
     self._control_panel.AddF( self._retry_failed, CC.FLAGS_LONE_BUTTON )
     self._control_panel.AddF( self._check_now_button, CC.FLAGS_LONE_BUTTON )
     self._control_panel.AddF( self._reset_cache_button, CC.FLAGS_LONE_BUTTON )
     
     #
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.AddF( ClientGUICommon.WrapInText( self._name, self, 'name: ' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.AddF( self._info_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._query_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._options_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._control_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._import_tag_options, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._import_file_options, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     self.SetSizer( vbox )
Exemplo n.º 11
0
 def __init__( self, parent, info ):
     
     ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
     
     self._original_info = info
     
     ( self._mime, media_show_action, preview_show_action, ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) ) = self._original_info
     
     possible_actions = CC.media_viewer_capabilities[ self._mime ]
     
     self._media_show_action = ClientGUICommon.BetterChoice( self )
     self._preview_show_action = ClientGUICommon.BetterChoice( self )
     
     for action in possible_actions:
         
         self._media_show_action.Append( CC.media_viewer_action_string_lookup[ action ], action )
         
         if action != CC.MEDIA_VIEWER_ACTION_DO_NOT_SHOW_ON_ACTIVATION_OPEN_EXTERNALLY:
             
             self._preview_show_action.Append( CC.media_viewer_action_string_lookup[ action ], action )
             
         
     
     self._media_show_action.Bind( wx.EVT_CHOICE, self.EventActionChange )
     self._preview_show_action.Bind( wx.EVT_CHOICE, self.EventActionChange )
     
     self._media_scale_up = ClientGUICommon.BetterChoice( self )
     self._media_scale_down = ClientGUICommon.BetterChoice( self )
     self._preview_scale_up = ClientGUICommon.BetterChoice( self )
     self._preview_scale_down = ClientGUICommon.BetterChoice( self )
     
     for scale_action in ( CC.MEDIA_VIEWER_SCALE_100, CC.MEDIA_VIEWER_SCALE_MAX_REGULAR, CC.MEDIA_VIEWER_SCALE_TO_CANVAS ):
         
         text = CC.media_viewer_scale_string_lookup[ scale_action ]
         
         self._media_scale_up.Append( text, scale_action )
         self._preview_scale_up.Append( text, scale_action )
         
         if scale_action != CC.MEDIA_VIEWER_SCALE_100:
             
             self._media_scale_down.Append( text, scale_action )
             self._preview_scale_down.Append( text, scale_action )
             
         
     
     self._exact_zooms_only = wx.CheckBox( self, label = 'only permit half and double zooms' )
     self._exact_zooms_only.SetToolTipString( 'This limits zooms to 25%, 50%, 100%, 200%, 400%, and so on. It makes for fast resize and is useful for files that often have flat colours and hard edges, which often scale badly otherwise. The \'canvas fit\' zoom will still be inserted.' )
     
     self._scale_up_quality = ClientGUICommon.BetterChoice( self )
     
     for zoom in ( CC.ZOOM_NEAREST, CC.ZOOM_LINEAR, CC.ZOOM_CUBIC, CC.ZOOM_LANCZOS4 ):
         
         self._scale_up_quality.Append( CC.zoom_string_lookup[ zoom ], zoom )
         
     
     self._scale_down_quality = ClientGUICommon.BetterChoice( self )
     
     for zoom in ( CC.ZOOM_NEAREST, CC.ZOOM_LINEAR, CC.ZOOM_AREA ):
         
         self._scale_down_quality.Append( CC.zoom_string_lookup[ zoom ], zoom )
         
     
     #
     
     self._media_show_action.SelectClientData( media_show_action )
     self._preview_show_action.SelectClientData( preview_show_action )
     
     self._media_scale_up.SelectClientData( media_scale_up )
     self._media_scale_down.SelectClientData( media_scale_down )
     self._preview_scale_up.SelectClientData( preview_scale_up )
     self._preview_scale_down.SelectClientData( preview_scale_down )
     
     self._exact_zooms_only.SetValue( exact_zooms_only )
     
     self._scale_up_quality.SelectClientData( scale_up_quality )
     self._scale_down_quality.SelectClientData( scale_down_quality )
     
     #
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     text = 'Setting media view options for ' + HC.mime_string_lookup[ self._mime ] + '.'
     
     vbox.AddF( wx.StaticText( self, label = text ), CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( ClientGUICommon.WrapInText( self._media_show_action, self, 'media viewer show action:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.AddF( ClientGUICommon.WrapInText( self._preview_show_action, self, 'preview show action:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     if possible_actions == CC.no_support:
         
         self._media_scale_up.Hide()
         self._media_scale_down.Hide()
         self._preview_scale_up.Hide()
         self._preview_scale_down.Hide()
         
         self._exact_zooms_only.Hide()
         
         self._scale_up_quality.Hide()
         self._scale_down_quality.Hide()
         
     else:
         
         rows = []
         
         rows.append( ( 'if the media is smaller than the media viewer canvas: ', self._media_scale_up ) )
         rows.append( ( 'if the media is larger than the media viewer canvas: ', self._media_scale_down ) )
         rows.append( ( 'if the media is smaller than the preview canvas: ', self._preview_scale_up) )
         rows.append( ( 'if the media is larger than the preview canvas: ', self._preview_scale_down ) )
         
         gridbox = ClientGUICommon.WrapInGrid( self, rows )
         
         vbox.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
         
         vbox.AddF( self._exact_zooms_only, CC.FLAGS_EXPAND_PERPENDICULAR )
         
         vbox.AddF( wx.StaticText( self, label = 'Nearest neighbour is fast and ugly, 8x8 lanczos and area resampling are slower but beautiful.' ), CC.FLAGS_VCENTER )
         
         vbox.AddF( ClientGUICommon.WrapInText( self._scale_up_quality, self, '>100% (interpolation) quality:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
         vbox.AddF( ClientGUICommon.WrapInText( self._scale_down_quality, self, '<100% (decimation) quality:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
         
     
     if self._mime == HC.APPLICATION_FLASH:
         
         self._scale_up_quality.Disable()
         self._scale_down_quality.Disable()
         
     
     self.SetSizer( vbox )
Exemplo n.º 12
0
 def __init__( self, parent, service_type, account_type ):
     
     ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
     
     ( self._account_type_key, title, permissions, bandwidth_rules ) = account_type.ToTuple()
     
     self._title = wx.TextCtrl( self )
     
     permission_choices = self._GeneratePermissionChoices( service_type )
     
     self._permission_controls = []
     
     self._permissions_panel = ClientGUICommon.StaticBox( self, 'permissions' )
     
     gridbox_rows = []
     
     for ( content_type, action_rows ) in permission_choices:
         
         choice_control = ClientGUICommon.BetterChoice( self._permissions_panel )
         
         for ( label, action ) in action_rows:
             
             choice_control.Append( label, ( content_type, action ) )
             
         
         if content_type in permissions:
             
             selection_row = ( content_type, permissions[ content_type ] )
             
         else:
             
             selection_row = ( content_type, None )
             
         
         try:
             
             choice_control.SelectClientData( selection_row )
             
         except:
             
             choice_control.SelectClientData( ( content_type, None ) )
             
         
         self._permission_controls.append( choice_control )
         
         gridbox_label = HC.content_type_string_lookup[ content_type ]
         
         gridbox_rows.append( ( gridbox_label, choice_control ) )
         
     
     gridbox = ClientGUICommon.WrapInGrid( self._permissions_panel, gridbox_rows )
     
     self._bandwidth_rules_control = ClientGUIControls.BandwidthRulesCtrl( self, bandwidth_rules )
     
     #
     
     self._title.SetValue( title )
     
     #
     
     t_hbox = ClientGUICommon.WrapInText( self._title, self, 'title: ' )
     
     self._permissions_panel.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.AddF( t_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.AddF( self._permissions_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._bandwidth_rules_control, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     self.SetSizer( vbox )
Exemplo n.º 13
0
    def __init__(self, parent, checker_options):

        ClientGUIScrolledPanels.EditPanel.__init__(self, parent)

        help_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.help, self._ShowHelp)
        help_button.SetToolTip('Show help regarding these checker options.')

        help_hbox = ClientGUICommon.WrapInText(help_button, self,
                                               'help for this panel -->',
                                               wx.Colour(0, 0, 255))

        # add statictext or whatever that will update on any updates above to say 'given velocity of blah and last check at blah, next check in 5 mins'
        # or indeed this could just take the seed cache and last check of the caller, if there is one
        # this would be more useful to the user, to know 'right, on ok, it'll refresh in 30 mins'

        self._intended_files_per_check = wx.SpinCtrl(self, min=1, max=1000)

        self._never_faster_than = TimeDeltaCtrl(self,
                                                min=30,
                                                days=True,
                                                hours=True,
                                                minutes=True,
                                                seconds=True)

        self._never_slower_than = TimeDeltaCtrl(self,
                                                min=600,
                                                days=True,
                                                hours=True,
                                                minutes=True)

        self._death_file_velocity = VelocityCtrl(self,
                                                 min_time_delta=60,
                                                 days=True,
                                                 hours=True,
                                                 minutes=True,
                                                 per_phrase='in',
                                                 unit='files')

        #

        (intended_files_per_check, never_faster_than, never_slower_than,
         death_file_velocity) = checker_options.ToTuple()

        self._intended_files_per_check.SetValue(intended_files_per_check)
        self._never_faster_than.SetValue(never_faster_than)
        self._never_slower_than.SetValue(never_slower_than)
        self._death_file_velocity.SetValue(death_file_velocity)

        #

        rows = []

        rows.append(
            ('intended new files per check: ', self._intended_files_per_check))
        rows.append(('stop checking if new files found falls below: ',
                     self._death_file_velocity))
        rows.append(
            ('never check faster than once per: ', self._never_faster_than))
        rows.append(
            ('never check slower than once per: ', self._never_slower_than))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.Add(help_hbox, CC.FLAGS_BUTTON_SIZER)
        vbox.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)

        self.SetSizer(vbox)
Exemplo n.º 14
0
 def __init__( self, parent, checker_options ):
     
     ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
     
     help_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.help, self._ShowHelp )
     help_button.SetToolTip( 'Show help regarding these checker options.' )
     
     help_hbox = ClientGUICommon.WrapInText( help_button, self, 'help for this panel -->', wx.Colour( 0, 0, 255 ) )
     
     import ClientDefaults
     
     defaults_panel = ClientGUICommon.StaticBox( self, 'reasonable defaults' )
     
     defaults_1 = ClientGUICommon.BetterButton( defaults_panel, 'thread', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'thread' ) )
     defaults_2 = ClientGUICommon.BetterButton( defaults_panel, 'slow thread', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'slow thread' ) )
     defaults_3 = ClientGUICommon.BetterButton( defaults_panel, 'faster tag subscription', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'fast tag subscription' ) )
     defaults_4 = ClientGUICommon.BetterButton( defaults_panel, 'medium tag/artist subscription', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'artist subscription' ) )
     defaults_5 = ClientGUICommon.BetterButton( defaults_panel, 'slower tag subscription', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'slow tag subscription' ) )
     
     #
     
     # add statictext or whatever that will update on any updates above to say 'given velocity of blah and last check at blah, next check in 5 mins'
     # or indeed this could just take the file_seed cache and last check of the caller, if there is one
     # this would be more useful to the user, to know 'right, on ok, it'll refresh in 30 mins'
     # this is actually more complicated--it also needs last check time to calc a fresh file velocity based on new death_file_velocity
     
     #
     
     self._death_file_velocity = VelocityCtrl( self, min_time_delta = 60, days = True, hours = True, minutes = True, per_phrase = 'in', unit = 'files' )
     
     self._flat_check_period_checkbox = wx.CheckBox( self )
     
     #
     
     self._reactive_check_panel = ClientGUICommon.StaticBox( self, 'reactive checking' )
     
     self._intended_files_per_check = wx.SpinCtrl( self._reactive_check_panel, min = 1, max = 1000 )
     
     self._never_faster_than = TimeDeltaCtrl( self._reactive_check_panel, min = 30, days = True, hours = True, minutes = True, seconds = True )
     
     self._never_slower_than = TimeDeltaCtrl( self._reactive_check_panel, min = 600, days = True, hours = True, minutes = True )
     
     #
     
     self._static_check_panel = ClientGUICommon.StaticBox( self, 'static checking' )
     
     self._flat_check_period = TimeDeltaCtrl( self._static_check_panel, min = 180, days = True, hours = True, minutes = True )
     
     #
     
     self.SetValue( checker_options )
     
     #
     
     defaults_panel.Add( defaults_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_3, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_4, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_5, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'intended new files per check: ', self._intended_files_per_check ) )
     rows.append( ( 'never check faster than once per: ', self._never_faster_than ) )
     rows.append( ( 'never check slower than once per: ', self._never_slower_than ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._reactive_check_panel, rows )
     
     self._reactive_check_panel.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'check period: ', self._flat_check_period ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._static_check_panel, rows )
     
     self._static_check_panel.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'stop checking if new files found falls below: ', self._death_file_velocity ) )
     rows.append( ( 'just check at a static, regular interval: ', self._flat_check_period_checkbox ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self, rows )
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.Add( help_hbox, CC.FLAGS_BUTTON_SIZER )
     vbox.Add( defaults_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.Add( self._reactive_check_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._static_check_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     self.SetSizer( vbox )
     
     #
     
     self._flat_check_period_checkbox.Bind( wx.EVT_CHECKBOX, self.EventFlatPeriodCheck )