コード例 #1
0
    def _PopulateCenterButtons(self):

        self._archive_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.archive, self._Archive)

        self._trash_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.delete, HydrusGlobals.client_controller.pub,
            'canvas_delete', self._canvas_key)
        self._trash_button.SetToolTipString('send to trash')

        self._delete_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.trash_delete,
            HydrusGlobals.client_controller.pub, 'canvas_delete',
            self._canvas_key)
        self._delete_button.SetToolTipString('delete completely')

        self._undelete_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.undelete, HydrusGlobals.client_controller.pub,
            'canvas_undelete', self._canvas_key)
        self._undelete_button.SetToolTipString('undelete')

        self._top_hbox.AddF(self._archive_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._trash_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._delete_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._undelete_button, CC.FLAGS_VCENTER)
コード例 #2
0
ファイル: ClientGUIPredicates.py プロジェクト: salrana/hydrus
    def __init__(self, parent):

        PanelPredicateSystem.__init__(self, parent)

        self._sign = wx.RadioBox(
            self, choices=['=', 'wider than', 'taller than', u'\u2248'])

        self._width = wx.SpinCtrl(self, max=50000, size=(60, -1))

        self._height = wx.SpinCtrl(self, max=50000, size=(60, -1))

        system_predicates = HC.options['file_system_predicates']

        (sign, width, height) = system_predicates['ratio']

        self._sign.SetStringSelection(sign)

        self._width.SetValue(width)

        self._height.SetValue(height)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(ClientGUICommon.BetterStaticText(self, 'system:ratio'),
                 CC.FLAGS_VCENTER)
        hbox.Add(self._sign, CC.FLAGS_VCENTER)
        hbox.Add(self._width, CC.FLAGS_VCENTER)
        hbox.Add(ClientGUICommon.BetterStaticText(self, ':'), CC.FLAGS_VCENTER)
        hbox.Add(self._height, CC.FLAGS_VCENTER)

        self.SetSizer(hbox)

        wx.CallAfter(self._sign.SetFocus)
コード例 #3
0
 def __init__( self, parent, my_canvas, canvas_key ):
     
     FullscreenHoverFrame.__init__( self, parent, my_canvas, canvas_key )
     
     self._current_zoom = 1.0
     self._current_index_string = ''
     
     self._top_hbox = wx.BoxSizer( wx.HORIZONTAL )
     self._title_text = ClientGUICommon.BetterStaticText( self, 'title' )
     self._info_text = ClientGUICommon.BetterStaticText( self, 'info' )
     self._additional_info_text = ClientGUICommon.BetterStaticText( self, '', style = wx.ALIGN_CENTER )
     self._button_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     self._PopulateLeftButtons()
     self._top_hbox.Add( ( 20, 20 ), CC.FLAGS_EXPAND_BOTH_WAYS )
     self._PopulateCenterButtons()
     self._top_hbox.Add( ( 20, 20 ), CC.FLAGS_EXPAND_BOTH_WAYS )
     self._PopulateRightButtons()
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.Add( self._top_hbox, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._title_text, CC.FLAGS_CENTER )
     vbox.Add( self._info_text, CC.FLAGS_CENTER )
     vbox.Add( self._additional_info_text, CC.FLAGS_CENTER )
     vbox.Add( self._button_hbox, CC.FLAGS_CENTER )
     
     self.SetSizer( vbox )
     
     HG.client_controller.sub( self, 'ProcessContentUpdates', 'content_updates_gui' )
     HG.client_controller.sub( self, 'SetCurrentZoom', 'canvas_new_zoom' )
     HG.client_controller.sub( self, 'SetIndexString', 'canvas_new_index_string' )
     
     self.Bind( wx.EVT_MOUSEWHEEL, self.EventMouseWheel )
コード例 #4
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 )
コード例 #5
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)
コード例 #6
0
    def __init__(self, parent, controller):

        self._controller = controller

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._notebook = wx.Notebook(self)

        self._local_listbook = ClientGUICommon.ListBook(self._notebook)
        self._remote_listbook = ClientGUICommon.ListBook(self._notebook)

        self._notebook.AddPage(self._local_listbook, 'local')
        self._notebook.AddPage(self._remote_listbook, 'remote')

        self._InitialiseServices()

        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.EventPageChanged)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(self._notebook, CC.FLAGS_EXPAND_BOTH_WAYS)

        self.SetSizer(vbox)

        self._controller.sub(self, 'RefreshServices',
                             'notify_new_services_gui')
コード例 #7
0
ファイル: ClientGUIACDropdown.py プロジェクト: calcza/hydrus
    def _ShouldShow(self):

        tlp_active = self.GetTopLevelParent().IsActive(
        ) or self._dropdown_window.IsActive()

        if HC.PLATFORM_LINUX:

            tlp = self.GetTopLevelParent()

            if isinstance(tlp, wx.Dialog):

                visible = True

            else:

                # notebook on linux doesn't 'hide' things apparently, so isshownonscreen, which recursively tests parents' hide status, doesn't work!

                gui = HG.client_controller.GetGUI()

                current_page = gui.GetCurrentPage()

                visible = ClientGUICommon.IsWXAncestor(self, current_page)

        else:

            visible = self._text_ctrl.IsShownOnScreen()

        focus_remains_on_self_or_children = ClientGUICommon.WindowOrAnyTLPChildHasFocus(
            self)

        return tlp_active and visible and focus_remains_on_self_or_children
コード例 #8
0
    def __init__(self, parent):

        OptionsPanel.__init__(self, parent)

        self._auto_archive = wx.CheckBox(self, label='archive all imports')
        self._auto_archive.Bind(wx.EVT_CHECKBOX, self.EventChanged)

        self._exclude_deleted = wx.CheckBox(
            self, label='exclude already deleted files')
        self._exclude_deleted.Bind(wx.EVT_CHECKBOX, self.EventChanged)

        self._min_size = ClientGUICommon.NoneableSpinCtrl(
            self, 'minimum size (KB): ', multiplier=1024)
        self._min_size.SetValue(5120)
        self._min_size.Bind(wx.EVT_SPINCTRL, self.EventChanged)

        self._min_resolution = ClientGUICommon.NoneableSpinCtrl(
            self, 'minimum resolution: ', num_dimensions=2)
        self._min_resolution.SetValue((50, 50))
        self._min_resolution.Bind(wx.EVT_SPINCTRL, self.EventChanged)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(self._auto_archive, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._exclude_deleted, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._min_size, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._min_resolution, CC.FLAGS_EXPAND_PERPENDICULAR)

        self.SetSizer(vbox)

        self.SetOptions(ClientDefaults.GetDefaultImportFileOptions())
コード例 #9
0
ファイル: ClientGUIControls.py プロジェクト: ipatrol/hydrus
 def __init__( self, parent, bandwidth_rules ):
     
     ClientGUICommon.StaticBox.__init__( self, parent, 'bandwidth rules' )
     
     columns = [ ( 'type', -1 ), ( 'time delta', 120 ), ( 'max allowed', 80 ) ]
     
     self._listctrl = ClientGUICommon.SaneListCtrl( self, 100, columns, delete_key_callback = self._Delete, activation_callback = self._Edit )
     
     self._add_button = ClientGUICommon.BetterButton( self, 'add', self._Add )
     self._edit_button = ClientGUICommon.BetterButton( self, 'edit', self._Edit )
     self._delete_button = ClientGUICommon.BetterButton( self, 'delete', self._Delete )
     
     #
     
     for rule in bandwidth_rules.GetRules():
         
         sort_tuple = rule
         
         display_tuple = self._GetDisplayTuple( sort_tuple )
         
         self._listctrl.Append( display_tuple, sort_tuple )
         
     
     #
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.AddF( self._add_button, CC.FLAGS_LONE_BUTTON )
     hbox.AddF( self._edit_button, CC.FLAGS_LONE_BUTTON )
     hbox.AddF( self._delete_button, CC.FLAGS_LONE_BUTTON )
     
     self.AddF( self._listctrl, CC.FLAGS_EXPAND_PERPENDICULAR )
     self.AddF( hbox, CC.FLAGS_BUTTON_SIZER )
コード例 #10
0
 def _PopulateCenterButtons( self ):
     
     menu_items = []
     
     menu_items.append( ( 'normal', 'edit duplicate action options for \'this is better\'', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_BETTER ) ) )
     menu_items.append( ( 'normal', 'edit duplicate action options for \'same quality\'', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_SAME_QUALITY ) ) )
     menu_items.append( ( 'normal', 'edit duplicate action options for \'alternates\'', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_ALTERNATE ) ) )
     menu_items.append( ( 'normal', 'edit duplicate action options for \'not duplicates\'', 'edit what content is merged when you filter files', HydrusData.Call( self._EditMergeOptions, HC.DUPLICATE_NOT_DUPLICATE ) ) )
     menu_items.append( ( 'separator', None, None, None ) )
     menu_items.append( ( 'normal', 'edit background lighten/darken switch intensity', 'edit how much the background will brighten or darken as you switch between the pair', self._EditBackgroundSwitchIntensity ) )
     
     cog_button = ClientGUICommon.MenuBitmapButton( self, CC.GlobalBMPs.cog, menu_items )
     
     self._top_hbox.Add( cog_button, CC.FLAGS_SIZER_VCENTER )
     
     FullscreenHoverFrameTopNavigable._PopulateCenterButtons( self )
     
     dupe_commands = []
     
     dupe_commands.append( ( 'this is better', 'Set that the current file you are looking at is better than the other in the pair.', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'duplicate_filter_this_is_better' ) ) )
     dupe_commands.append( ( 'same quality', 'Set that the two files are duplicates of very similar quality.', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'duplicate_filter_exactly_the_same' ) ) )
     dupe_commands.append( ( 'alternates', 'Set that the files are not duplicates, but that one is derived from the other or that they are both descendants of a common ancestor.', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'duplicate_filter_alternates' ) ) )
     dupe_commands.append( ( 'not duplicates', 'Set that the files are not duplicates or otherwise related--that this pair is a false-positive match.', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'duplicate_filter_not_dupes' ) ) )
     dupe_commands.append( ( 'custom action', 'Choose one of the other actions but customise the merge and delete options for this specific decision.', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'duplicate_filter_custom_action' ) ) )
     
     for ( label, tooltip, command ) in dupe_commands:
         
         command_button = ClientGUICommon.BetterButton( self, label, HG.client_controller.pub, 'canvas_application_command', command, self._canvas_key )
         
         command_button.SetToolTip( tooltip )
         
         self._button_hbox.Add( command_button, CC.FLAGS_VCENTER )
コード例 #11
0
ファイル: ClientGUIPredicates.py プロジェクト: salrana/hydrus
    def __init__(self, parent):

        PanelPredicateSystem.__init__(self, parent)

        self._operator = ClientGUICommon.BetterChoice(self)

        self._operator.Append('has', True)
        self._operator.Append('does not have', False)

        self._url_matches = ClientGUICommon.BetterChoice(self)

        for url_match in HG.client_controller.network_engine.domain_manager.GetURLMatches(
        ):

            if url_match.ShouldAssociateWithFiles():

                self._url_matches.Append(url_match.GetName(), url_match)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(ClientGUICommon.BetterStaticText(self, 'system:known url'),
                 CC.FLAGS_VCENTER)
        hbox.Add(self._operator, CC.FLAGS_VCENTER)
        hbox.Add(
            ClientGUICommon.BetterStaticText(self, 'url matching this class:'),
            CC.FLAGS_VCENTER)
        hbox.Add(self._url_matches, CC.FLAGS_VCENTER)

        self.SetSizer(hbox)
コード例 #12
0
ファイル: ClientGUIControls.py プロジェクト: ipatrol/hydrus
 def __init__( self, parent, initial_dict ):
     
     wx.Panel.__init__( self, parent )
     
     self._listctrl = ClientGUICommon.SaneListCtrl( self, 120, [ ( 'key', 200 ), ( 'value', -1 ) ], delete_key_callback = self.Delete, activation_callback = self.Edit )
     
     self._add = ClientGUICommon.BetterButton( self, 'add', self.Add )
     self._edit = ClientGUICommon.BetterButton( self, 'edit', self.Edit )
     self._delete = ClientGUICommon.BetterButton( self, 'delete', self.Delete )
     
     #
     
     for display_tuple in initial_dict.items():
         
         self._listctrl.Append( display_tuple, display_tuple )
         
     
     #
     
     button_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     button_hbox.AddF( self._add, CC.FLAGS_VCENTER )
     button_hbox.AddF( self._edit, CC.FLAGS_VCENTER )
     button_hbox.AddF( self._delete, CC.FLAGS_VCENTER )
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.AddF( self._listctrl, CC.FLAGS_EXPAND_BOTH_WAYS )
     vbox.AddF( button_hbox, CC.FLAGS_BUTTON_SIZER )
     
     self.SetSizer( vbox )
コード例 #13
0
    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)
コード例 #14
0
 def __init__( self, parent ):
     
     PanelPredicateSystem.__init__( self, parent )
     
     self._viewing_locations = ClientGUICommon.BetterCheckListBox( self )
     
     self._viewing_locations.Append( 'media viewtime', 'media' )
     self._viewing_locations.Append( 'preview viewtime', 'preview' )
     
     self._sign = wx.RadioBox( self, choices = [ '<', u'\u2248', '=', '>' ] )
     
     self._time_delta = ClientGUITime.TimeDeltaCtrl( self, min = 0, days = True, hours = True, minutes = True, seconds = True )
     
     #
     
     self._viewing_locations.Check( 0 )
     
     self._sign.Select( 3 )
     
     self._time_delta.SetValue( 600 )
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:' ), CC.FLAGS_VCENTER )
     hbox.Add( self._viewing_locations, CC.FLAGS_VCENTER )
     hbox.Add( self._sign, CC.FLAGS_VCENTER )
     hbox.Add( self._time_delta, CC.FLAGS_VCENTER )
     
     self.SetSizer( hbox )
コード例 #15
0
 def __init__( self, parent ):
     
     PanelPredicateSystem.__init__( self, parent )
     
     self._viewing_locations = ClientGUICommon.BetterCheckListBox( self )
     
     self._viewing_locations.Append( 'media views', 'media' )
     self._viewing_locations.Append( 'preview views', 'preview' )
     
     self._sign = wx.RadioBox( self, choices = [ '<', u'\u2248', '=', '>' ] )
     
     self._value = wx.SpinCtrl( self, min = 0, max = 1000000 )
     
     #
     
     self._viewing_locations.Check( 0 )
     
     self._sign.Select( 3 )
     
     self._value.SetValue( 10 )
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:' ), CC.FLAGS_VCENTER )
     hbox.Add( self._viewing_locations, CC.FLAGS_VCENTER )
     hbox.Add( self._sign, CC.FLAGS_VCENTER )
     hbox.Add( self._value, CC.FLAGS_VCENTER )
     
     self.SetSizer( hbox )
コード例 #16
0
 def __init__( self, parent ):
     
     PanelPredicateSystem.__init__( self, parent )
     
     choices = [ '<', u'\u2248', '=', '>' ]
     
     self._sign = wx.RadioBox( self, choices = choices, style = wx.RA_SPECIFY_COLS )
     
     self._num = wx.SpinCtrl( self, min = 0, max = 65535 )
     
     choices = [ ( HC.duplicate_type_string_lookup[ status ], status ) for status in ( HC.DUPLICATE_BETTER_OR_WORSE, HC.DUPLICATE_BETTER, HC.DUPLICATE_WORSE, HC.DUPLICATE_SAME_QUALITY, HC.DUPLICATE_ALTERNATE, HC.DUPLICATE_NOT_DUPLICATE, HC.DUPLICATE_UNKNOWN ) ]
     
     self._dupe_type = ClientGUICommon.BetterRadioBox( self, choices = choices, style = wx.RA_SPECIFY_ROWS )
     
     #
     
     self._sign.SetStringSelection( '>' )
     self._num.SetValue( 0 )
     
     #
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:num duplicate relationships' ), CC.FLAGS_VCENTER )
     hbox.Add( self._sign, CC.FLAGS_VCENTER )
     hbox.Add( self._num, CC.FLAGS_VCENTER )
     hbox.Add( self._dupe_type, CC.FLAGS_VCENTER )
     
     self.SetSizer( hbox )
     
     wx.CallAfter( self._num.SetFocus )
コード例 #17
0
ファイル: ClientGUITime.py プロジェクト: salrana/hydrus
 def __init__( self, parent, min = 1, days = False, hours = False, minutes = False, seconds = False, monthly_allowed = False, monthly_label = 'monthly' ):
     
     wx.Panel.__init__( self, parent )
     
     self._min = min
     self._show_days = days
     self._show_hours = hours
     self._show_minutes = minutes
     self._show_seconds = seconds
     self._monthly_allowed = monthly_allowed
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     if self._show_days:
         
         self._days = wx.SpinCtrl( self, min = 0, max = 3653, size = ( 50, -1 ) )
         self._days.Bind( wx.EVT_SPINCTRL, self.EventChange )
         
         hbox.Add( self._days, CC.FLAGS_VCENTER )
         hbox.Add( ClientGUICommon.BetterStaticText( self, 'days' ), CC.FLAGS_VCENTER )
         
     
     if self._show_hours:
         
         self._hours = wx.SpinCtrl( self, min = 0, max = 23, size = ( 45, -1 ) )
         self._hours.Bind( wx.EVT_SPINCTRL, self.EventChange )
         
         hbox.Add( self._hours, CC.FLAGS_VCENTER )
         hbox.Add( ClientGUICommon.BetterStaticText( self, 'hours' ), CC.FLAGS_VCENTER )
         
     
     if self._show_minutes:
         
         self._minutes = wx.SpinCtrl( self, min = 0, max = 59, size = ( 45, -1 ) )
         self._minutes.Bind( wx.EVT_SPINCTRL, self.EventChange )
         
         hbox.Add( self._minutes, CC.FLAGS_VCENTER )
         hbox.Add( ClientGUICommon.BetterStaticText( self, 'minutes' ), CC.FLAGS_VCENTER )
         
     
     if self._show_seconds:
         
         self._seconds = wx.SpinCtrl( self, min = 0, max = 59, size = ( 45, -1 ) )
         self._seconds.Bind( wx.EVT_SPINCTRL, self.EventChange )
         
         hbox.Add( self._seconds, CC.FLAGS_VCENTER )
         hbox.Add( ClientGUICommon.BetterStaticText( self, 'seconds' ), CC.FLAGS_VCENTER )
         
     
     if self._monthly_allowed:
         
         self._monthly = wx.CheckBox( self )
         self._monthly.Bind( wx.EVT_CHECKBOX, self.EventChange )
         
         hbox.Add( self._monthly, CC.FLAGS_VCENTER )
         hbox.Add( ClientGUICommon.BetterStaticText( self, monthly_label ), CC.FLAGS_VCENTER )
         
     
     self.SetSizer( hbox )
コード例 #18
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)
コード例 #19
0
ファイル: ClientGUIPredicates.py プロジェクト: salrana/hydrus
    def __init__(self, parent):

        PanelPredicateSystem.__init__(self, parent)

        self._sign = wx.RadioBox(self, choices=['<', u'\u2248', '>'])

        self._years = wx.SpinCtrl(self, max=30, size=(60, -1))
        self._months = wx.SpinCtrl(self, max=60, size=(60, -1))
        self._days = wx.SpinCtrl(self, max=90, size=(60, -1))
        self._hours = wx.SpinCtrl(self, max=24, size=(60, -1))

        system_predicates = HC.options['file_system_predicates']

        try:

            (sign, age_type, (years, months, days,
                              hours)) = system_predicates['age']

        except:

            # wew lad. replace this all with proper system pred saving on new_options in future
            sign = '<'

            years = 0
            months = 0
            days = 7
            hours = 0

        self._sign.SetStringSelection(sign)

        self._years.SetValue(years)
        self._months.SetValue(months)
        self._days.SetValue(days)
        self._hours.SetValue(hours)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(
            ClientGUICommon.BetterStaticText(self, 'system:time imported'),
            CC.FLAGS_VCENTER)
        hbox.Add(self._sign, CC.FLAGS_VCENTER)
        hbox.Add(self._years, CC.FLAGS_VCENTER)
        hbox.Add(ClientGUICommon.BetterStaticText(self, 'years'),
                 CC.FLAGS_VCENTER)
        hbox.Add(self._months, CC.FLAGS_VCENTER)
        hbox.Add(ClientGUICommon.BetterStaticText(self, 'months'),
                 CC.FLAGS_VCENTER)
        hbox.Add(self._days, CC.FLAGS_VCENTER)
        hbox.Add(ClientGUICommon.BetterStaticText(self, 'days'),
                 CC.FLAGS_VCENTER)
        hbox.Add(self._hours, CC.FLAGS_VCENTER)
        hbox.Add(ClientGUICommon.BetterStaticText(self, 'hours'),
                 CC.FLAGS_VCENTER)

        self.SetSizer(hbox)

        wx.CallAfter(self._days.SetFocus)
コード例 #20
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)
コード例 #21
0
 def PausePlay( self ):
     
     self._job_key.PausePlay()
     
     if self._job_key.IsPaused():
         
         ClientGUICommon.SetBitmapButtonBitmap( self._pause_button, CC.GlobalBMPs.play )
         
     else:
         
         ClientGUICommon.SetBitmapButtonBitmap( self._pause_button, CC.GlobalBMPs.pause )
コード例 #22
0
 def _ResetArchiveButton( self ):
     
     if self._current_media.HasInbox():
         
         ClientGUICommon.SetBitmapButtonBitmap( self._archive_button, CC.GlobalBMPs.archive )
         self._archive_button.SetToolTip( 'archive' )
         
     else:
         
         ClientGUICommon.SetBitmapButtonBitmap( self._archive_button, CC.GlobalBMPs.to_inbox )
         self._archive_button.SetToolTip( 'return to inbox' )
コード例 #23
0
ファイル: ClientDragDrop.py プロジェクト: kororok/hydrus
    def OnDrop(self, x, y):

        drop_tlp = ClientGUICommon.GetXYTopTLP(x, y)
        my_tlp = ClientGUICommon.GetTLP(self._parent)

        if drop_tlp == my_tlp:

            return True

        else:

            return False
コード例 #24
0
        def __init__(self, parent, rule):

            ClientGUIScrolledPanels.EditPanel.__init__(self, parent)

            self._bandwidth_type = ClientGUICommon.BetterChoice(self)

            self._bandwidth_type.Append('data', HC.BANDWIDTH_TYPE_DATA)
            self._bandwidth_type.Append('requests', HC.BANDWIDTH_TYPE_REQUESTS)

            self._bandwidth_type.Bind(wx.EVT_CHOICE, self.EventBandwidth)

            self._max_allowed_bytes = BytesControl(self)
            self._max_allowed_requests = wx.SpinCtrl(self, min=1, max=1048576)

            self._time_delta = ClientGUITime.TimeDeltaButton(
                self,
                min=1,
                days=True,
                hours=True,
                minutes=True,
                seconds=True,
                monthly_allowed=True)

            #

            (bandwidth_type, time_delta, max_allowed) = rule

            self._bandwidth_type.SelectClientData(bandwidth_type)

            self._time_delta.SetValue(time_delta)

            if bandwidth_type == HC.BANDWIDTH_TYPE_DATA:

                self._max_allowed_bytes.SetValue(max_allowed)

            else:

                self._max_allowed_requests.SetValue(max_allowed)

            self._UpdateEnabled()

            #

            hbox = wx.BoxSizer(wx.HORIZONTAL)

            hbox.Add(self._max_allowed_bytes, CC.FLAGS_VCENTER)
            hbox.Add(self._max_allowed_requests, CC.FLAGS_VCENTER)
            hbox.Add(self._bandwidth_type, CC.FLAGS_VCENTER)
            hbox.Add(ClientGUICommon.BetterStaticText(self, ' every '),
                     CC.FLAGS_VCENTER)
            hbox.Add(self._time_delta, CC.FLAGS_VCENTER)

            self.SetSizer(hbox)
コード例 #25
0
 def _PopulateLeftButtons( self ):
     
     self._back_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.previous, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'archive_delete_filter_back' ), self._canvas_key )
     self._back_button.SetToolTip( 'back' )
     
     self._top_hbox.Add( self._back_button, CC.FLAGS_VCENTER )
     
     FullscreenHoverFrameTop._PopulateLeftButtons( self )
     
     self._skip_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.next, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'archive_delete_filter_skip' ), self._canvas_key )
     self._skip_button.SetToolTip( 'skip' )
     
     self._top_hbox.Add( self._skip_button, CC.FLAGS_VCENTER )
コード例 #26
0
 def _PopulateLeftButtons( self ):
     
     self._previous_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.previous, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_previous' ), self._canvas_key )
     self._previous_button.SetToolTip( 'previous' )
     
     self._index_text = ClientGUICommon.BetterStaticText( self, 'index' )
     
     self._next_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.next, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_next' ), self._canvas_key )
     self._next_button.SetToolTip( 'next' )
     
     self._top_hbox.Add( self._previous_button, CC.FLAGS_VCENTER )
     self._top_hbox.Add( self._index_text, CC.FLAGS_VCENTER )
     self._top_hbox.Add( self._next_button, CC.FLAGS_VCENTER )
コード例 #27
0
 def _PopulateLeftButtons( self ):
     
     self._first_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.first, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_first' ), self._canvas_key )
     self._first_button.SetToolTip( 'first' )
     
     self._top_hbox.Add( self._first_button, CC.FLAGS_VCENTER )
     
     FullscreenHoverFrameTopNavigable._PopulateLeftButtons( self )
     
     self._last_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.last, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_last' ), self._canvas_key )
     self._last_button.SetToolTip( 'last' )
     
     self._top_hbox.Add( self._last_button, CC.FLAGS_VCENTER )
コード例 #28
0
ファイル: ClientDragDrop.py プロジェクト: molecast/hydrus
    def OnDrop(self, x, y):

        screen_position = ClientGUICommon.ClientToScreen(self._parent, (x, y))

        drop_tlp = ClientGUICommon.GetXYTopTLP(screen_position)
        my_tlp = ClientGUICommon.GetTLP(self._parent)

        if drop_tlp == my_tlp:

            return True

        else:

            return False
コード例 #29
0
ファイル: ClientGUIShortcuts.py プロジェクト: salrana/hydrus
 def __init__( self, parent ):
     
     wx.Panel.__init__( self, parent )
     
     self._mouse_radio = wx.RadioButton( self, style = wx.RB_GROUP, label = 'mouse' )
     self._mouse_shortcut = ShortcutMouse( self, self._mouse_radio )
     
     self._keyboard_radio = wx.RadioButton( self, label = 'keyboard' )
     self._keyboard_shortcut = ShortcutKeyboard( self, self._keyboard_radio )
     
     #
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.Add( ClientGUICommon.BetterStaticText( self, 'Mouse events only work for the duplicate and archive/delete filters atm!' ), CC.FLAGS_EXPAND_PERPENDICULAR )
     
     gridbox = wx.FlexGridSizer( 2 )
     
     gridbox.AddGrowableCol( 1, 1 )
     
     gridbox.Add( self._mouse_radio, CC.FLAGS_VCENTER )
     gridbox.Add( self._mouse_shortcut, CC.FLAGS_EXPAND_BOTH_WAYS )
     gridbox.Add( self._keyboard_radio, CC.FLAGS_VCENTER )
     gridbox.Add( self._keyboard_shortcut, CC.FLAGS_EXPAND_BOTH_WAYS )
     
     vbox.Add( gridbox, CC.FLAGS_EXPAND_BOTH_WAYS )
     
     self.SetSizer( vbox )
コード例 #30
0
ファイル: ClientGUIPredicates.py プロジェクト: salrana/hydrus
    def __init__(self, parent):

        PanelPredicateSystem.__init__(self, parent)

        self._sign = wx.RadioBox(self, choices=['<', u'\u2248', '=', '>'])

        self._num_words = wx.SpinCtrl(self, max=1000000, size=(60, -1))

        system_predicates = HC.options['file_system_predicates']

        (sign, num_words) = system_predicates['num_words']

        self._sign.SetStringSelection(sign)

        self._num_words.SetValue(num_words)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(ClientGUICommon.BetterStaticText(self, 'system:num_words'),
                 CC.FLAGS_VCENTER)
        hbox.Add(self._sign, CC.FLAGS_VCENTER)
        hbox.Add(self._num_words, CC.FLAGS_VCENTER)

        self.SetSizer(hbox)

        wx.CallAfter(self._num_words.SetFocus)