예제 #1
0
    def __init__(self, parent, service_callable):

        ClientGUICommon.StaticBox.__init__(self, parent, 'ipfs daemon')

        self._is_running = False
        self._nocopy_enabled = False

        self._service_callable = service_callable

        self._running_status = ClientGUICommon.BetterStaticText(self)
        self._check_running_button = ClientGUICommon.BetterButton(
            self, 'check daemon', self._CheckRunning)
        self._nocopy_status = ClientGUICommon.BetterStaticText(self)
        self._check_nocopy = ClientGUICommon.BetterButton(
            self, 'check nocopy', self._CheckNoCopy)
        self._enable_nocopy = ClientGUICommon.BetterButton(
            self, 'enable nocopy', self._EnableNoCopy)

        self._check_running_button.setEnabled(False)
        self._check_nocopy.setEnabled(False)

        #

        gridbox = QP.GridLayout(cols=2)

        gridbox.setColumnStretch(1, 1)

        QP.AddToLayout(gridbox, self._check_running_button,
                       CC.FLAGS_EXPAND_BOTH_WAYS)
        QP.AddToLayout(gridbox, self._running_status,
                       CC.FLAGS_CENTER_PERPENDICULAR)
        QP.AddToLayout(gridbox, self._check_nocopy, CC.FLAGS_EXPAND_BOTH_WAYS)
        QP.AddToLayout(gridbox, self._nocopy_status,
                       CC.FLAGS_CENTER_PERPENDICULAR)
        QP.AddToLayout(gridbox, self._enable_nocopy, CC.FLAGS_EXPAND_BOTH_WAYS)
        QP.AddToLayout(gridbox, (20, 20), CC.FLAGS_CENTER_PERPENDICULAR)

        self.Add(gridbox, CC.FLAGS_EXPAND_BOTH_WAYS)

        #

        self._CheckRunning()
예제 #2
0
    def __init__(self, parent):

        QW.QWidget.__init__(self, parent)

        self._mouse_radio = QW.QRadioButton('mouse', self)
        self._mouse_shortcut = MouseShortcutWidget(self)

        self._keyboard_radio = QW.QRadioButton('keyboard', self)
        self._keyboard_shortcut = KeyboardShortcutWidget(self)

        #

        vbox = QP.VBoxLayout()

        QP.AddToLayout(
            vbox,
            ClientGUICommon.BetterStaticText(
                self,
                'Mouse events only work for some windows, mostly media viewer stuff, atm!'
            ), CC.FLAGS_EXPAND_PERPENDICULAR)

        gridbox = QP.GridLayout(cols=2)

        gridbox.setColumnStretch(1, 1)

        QP.AddToLayout(gridbox, self._mouse_radio,
                       CC.FLAGS_CENTER_PERPENDICULAR)
        QP.AddToLayout(gridbox, self._mouse_shortcut,
                       CC.FLAGS_EXPAND_BOTH_WAYS)
        QP.AddToLayout(gridbox, self._keyboard_radio,
                       CC.FLAGS_CENTER_PERPENDICULAR)
        QP.AddToLayout(gridbox, self._keyboard_shortcut,
                       CC.FLAGS_EXPAND_BOTH_WAYS)

        QP.AddToLayout(vbox, gridbox, CC.FLAGS_EXPAND_BOTH_WAYS)

        self.setLayout(vbox)

        self._mouse_shortcut.valueChanged.connect(self._mouse_radio.click)
        self._keyboard_shortcut.valueChanged.connect(
            self._keyboard_radio.click)
 def __init__( self, parent, predicates ):
     
     PanelPredicateSystemMultiple.__init__( self, parent )
     
     #
     
     local_like_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_RATING_LIKE, ) )
     
     self._like_checkboxes_to_info = {}
     
     self._like_rating_ctrls = []
     
     gridbox = QP.GridLayout( cols = 5 )
     
     gridbox.setColumnStretch( 0, 1 )
     
     predicates = self._GetPredicatesToInitialisePanelWith( predicates )
     
     service_keys_to_predicates = { predicate.GetValue()[2] : predicate for predicate in predicates }
     
     self._rating_panels = []
     
     for service_key in local_like_service_keys:
         
         if service_key in service_keys_to_predicates:
             
             predicate = service_keys_to_predicates[ service_key ]
             
         else:
             
             predicate = None
             
         
         panel = PredicateSystemRatingLikeControl( self, service_key, predicate )
         
         self._rating_panels.append( panel )
         
     
     #
     
     local_numerical_service_keys = HG.client_controller.services_manager.GetServiceKeys( ( HC.LOCAL_RATING_NUMERICAL, ) )
     
     self._numerical_checkboxes_to_info = {}
     
     self._numerical_rating_ctrls_to_info = {}
     
     for service_key in local_numerical_service_keys:
         
         if service_key in service_keys_to_predicates:
             
             predicate = service_keys_to_predicates[ service_key ]
             
         else:
             
             predicate = None
             
         
         panel = PredicateSystemRatingNumericalControl( self, service_key, predicate )
         
         self._rating_panels.append( panel )
         
     
     #
     
     vbox = QP.VBoxLayout()
     
     for panel in self._rating_panels:
         
         QP.AddToLayout( vbox, panel, CC.FLAGS_EXPAND_PERPENDICULAR )
         
     
     self.setLayout( vbox )
    def __init__(self, parent, selectable_mimes):

        OptionsPanel.__init__(self, parent)

        self._selectable_mimes = set(selectable_mimes)

        self._mimes_to_checkboxes = {}
        self._general_mime_types_to_checkboxes = {}
        self._general_mime_types_to_buttons = {}

        general_mime_types = []

        general_mime_types.append(HC.GENERAL_IMAGE)
        general_mime_types.append(HC.GENERAL_ANIMATION)
        general_mime_types.append(HC.GENERAL_VIDEO)
        general_mime_types.append(HC.GENERAL_AUDIO)
        general_mime_types.append(HC.GENERAL_APPLICATION)

        gridbox = QP.GridLayout(cols=3)

        gridbox.setColumnStretch(2, 1)

        for general_mime_type in general_mime_types:

            mimes_in_type = self._GetMimesForGeneralMimeType(general_mime_type)

            if len(mimes_in_type) == 0:

                continue

            general_mime_checkbox = QW.QCheckBox(
                HC.mime_string_lookup[general_mime_type], self)
            general_mime_checkbox.clicked.connect(self.EventMimeGroupCheckbox)

            self._general_mime_types_to_checkboxes[
                general_mime_type] = general_mime_checkbox

            QP.AddToLayout(gridbox, general_mime_checkbox,
                           CC.FLAGS_CENTER_PERPENDICULAR)

            show_hide_button = ClientGUICommon.BetterButton(
                self, self.BUTTON_CURRENTLY_SHOWING, self._ButtonShowHide,
                general_mime_type)

            max_width = ClientGUIFunctions.ConvertTextToPixelWidth(
                show_hide_button, 5)

            show_hide_button.setMaximumWidth(max_width)

            self._general_mime_types_to_buttons[
                general_mime_type] = show_hide_button

            QP.AddToLayout(gridbox, show_hide_button,
                           CC.FLAGS_CENTER_PERPENDICULAR)

            vbox = QP.VBoxLayout()

            for mime in mimes_in_type:

                m_checkbox = QW.QCheckBox(HC.mime_string_lookup[mime], self)
                m_checkbox.clicked.connect(self.EventMimeCheckbox)

                self._mimes_to_checkboxes[mime] = m_checkbox

                QP.AddToLayout(vbox, m_checkbox, CC.FLAGS_EXPAND_PERPENDICULAR)

            QP.AddToLayout(gridbox, vbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)

        self.setLayout(gridbox)