当前位置: 首页>>代码示例>>Python>>正文


Python HIGButton.set_sensitive方法代码示例

本文整理汇总了Python中higwidgets.higbuttons.HIGButton.set_sensitive方法的典型用法代码示例。如果您正苦于以下问题:Python HIGButton.set_sensitive方法的具体用法?Python HIGButton.set_sensitive怎么用?Python HIGButton.set_sensitive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在higwidgets.higbuttons.HIGButton的用法示例。


在下文中一共展示了HIGButton.set_sensitive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SchedSchemaEditor

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_sensitive [as 别名]

#.........这里部分代码省略.........
        """
        Load schemas profiles.
        """
        schemas = ConfigParser()
        schemas.read(Path.sched_schemas)

        self.sections = []
        self.schema_name.get_model().clear()
        for section in schemas.sections():
            self.sections.append(section)
            self.schema_name.append_text(section)

        self.schema_name.set_active(0)
        self._check_schema(None)

    def _load_schema(self):
        """
        Load current set schedule schema.
        """
        schema = ConfigParser()
        schema.read(Path.sched_schemas)

        values = {
            "command": self.scan_command.set_text,
            "saveto": self.setting_saveto_entry.set_text,
            "mailto": self.setting_mailto_entry.set_text,
        }
        enable = {"saveto": self.setting_saveto.set_active, "mailto": self.setting_mailto.set_active}

        for item in schema.items(self.schema_name.get_active_text()):
            if item[0] == "addtoinv":
                self.setting_addtoinv.set_active(int(item[1]))
                if item[1] == "2":
                    self.apply.set_sensitive(False)
                    self.ok.set_sensitive(False)
                else:
                    self.apply.set_sensitive(True)
                    self.ok.set_sensitive(True)
            elif item[0] == "enabled":
                self.setting_enabled.set_active(int(item[1]))
            elif item[0] == "profile":
                pindx = self.profiles.index(item[1])
                self.sched_name.set_active(pindx)
            elif item[0] == "smtp":
                if item[1]:
                    pindx = self.smtp_sections.index(item[1])
                    self.setting_smtp.set_active(pindx)
            else:
                values[item[0]](item[1])
                if item[0] in ("saveto", "mailto"):
                    if len(item[1]):
                        enable[item[0]](True)
                    else:
                        enable[item[0]](False)

    def _check_schema(self, event):
        """
        Check if current text in schema_name combobox is a schema name.
        """
        if self.schema_name.get_active_text() in self.sections:
            # load schema
            self._load_schema()
        else:
            # reset to default values
            self.apply.set_sensitive(True)
            self.ok.set_sensitive(True)
开发者ID:umitproject,项目名称:network-scanner,代码行数:70,代码来源:SchedulerEdit.py

示例2: OptionDisplayMainFrame

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_sensitive [as 别名]

#.........这里部分代码省略.........
                            commands.append(cmd2)
                            boxedit.send_signal_save()
                        for i in wizard:
                            boxedit = self._wizard.notebook.get_page_name(i[0])
                            widget = boxedit.search_option(i[1])
                            cmd = CommandAddRemoveOption(widget,
                                                         boxedit,
                                                         self._wizardcore,
                                                         boxedit,
                                                         False)

                            cmd2 = CommandAddRemoveVoidplace(boxedit,
                                                             widget,
                                                             boxedit._coords,
                                                             False)
                            commands.append(cmd)
                            commands.append(cmd2)
                            boxedit.send_signal_save()
                        cmd3 = CommandAddRemoveOptionMode(self.get_option(),
                                                          self.optionlist.options,
                                                          self.optionlist.get_model(),
                                                          self,
                                                          False)
                        commands.append(cmd3)
                        cmd = CommandContainer('Remove option and deps',
                                               True,
                                               commands)
                        command_manager.add_command(cmd)
                        self.emit('need-save', None, None)


                    else: 
                        return

            else: 
                d = HIGAlertDialog(type= gtk.MESSAGE_ERROR, 
                                   message_format=_('ERROR'),
                                   secondary_text=_('Option do not exists')
                                   )
                d.run()
                d.destroy()
    def is_changed(self):
        return self._changed

    def do_need_save(self,action, event):
        self._changed = True 
        log.debug('<<< do_need_save')
    def set_notebook(self, notebook):
        self._notebook = notebook

    def update_option(self, widget):
        """
        Update option
        @param widget: widget from connect
        @type widget: HIGButton
        """
        name = self.name_entry.get_text()
        if name == '':
            d = HIGAlertDialog(type=gtk.MESSAGE_ERROR, 
                               message_format=_('Invalid name option '), 
                               secondary_text='Fill fields of option')
            d.run()
            d.destroy()
        else:	
            if self.optionlist.options.exists(name): 
                opt = self.get_option()
                self.optionlist.options.remove_option(name)
                self.optionlist.add(opt)



    def new_option(self, widget):
        """
        Clean Option Display
        @param widget: widget from connect
        @type widget: HIGButton
        """   
        self.clear()
        self.add_button.set_sensitive(True)
        self.update_button.set_sensitive(False)
        self.delete_button.set_sensitive(False)

    def add_option(self, widget):
        """
        Add option
        @param widget: widget from connect
        @type widget: HIGButton
        """

        if self.name_entry.get_text()=="":
            d = HIGAlertDialog(type=gtk.MESSAGE_ERROR, 
                               message_format=_('No fields entered'), 
                               secondary_text=_('Blank options is not allowed!'))
            d.run()
            d.destroy()
        else:
            opt = self.get_option()
            self.optionlist.add(opt)
            self.add_button.set_sensitive(False)
            self.emit('need-save', None, None)
开发者ID:aregee,项目名称:network-scanner,代码行数:104,代码来源:OptionManager.py

示例3: AddSourceDialog

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_sensitive [as 别名]
class AddSourceDialog(HIGDialog):
    def __init__(self, type_ = None, path = None):
        if type_ and path:
            title = _("Edit Source")
        else:
            type_ = "FILE"
            path = ""
            title = _("Add Source")
        HIGDialog.__init__(self, title, None,
                           gtk.DIALOG_MODAL,
                           (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                            gtk.STOCK_OK, gtk.RESPONSE_OK))
        hbox = HIGHBox()
        self.combo = gtk.combo_box_new_text()
        types = sorted(self.types.keys())
        for t in types:
            self.combo.append_text(t)
        self.combo.set_active(types.index(type_))
        self.combo.connect("changed", self._changed_cb)
        hbox.pack_start(self.combo, False, False)
        self.entry = HIGTextEntry()
        self.entry.set_text(path)
        hbox.pack_start(self.entry)
        self.btn = HIGButton(_("Browse..."), stock=gtk.STOCK_OPEN)
        self.btn.connect("clicked", self._clicked_cb)
        hbox.pack_start(self.btn, False, False)
        self.vbox.add(hbox)
        self.show_all()
        self.update()

    def update(self):
         callback, = self.types[self.combo.get_active_text()]
         self.btn.set_sensitive(not callback is None)

    def _browse_file(self, p):
        file_chooser = AllFilesFileChooserDialog(_("Select Script"))
        response = file_chooser.run()
        filename = file_chooser.get_filename()
        file_chooser.destroy()
        if not response == gtk.RESPONSE_OK:
            return
        self.entry.set_text(filename)

    def _browse_folder(self, p):
        file_chooser = DirectoryChooserDialog(_("Select Scripts Directory"))
        response = file_chooser.run()
        dirname = file_chooser.get_filename()
        file_chooser.destroy()
        if not response == gtk.RESPONSE_OK:
            return False
        self.entry.set_text(dirname)

    types = {
        "FILE" : (_browse_file, ),
        "DIR" : (_browse_folder, ),
        "URL" : (None, ), 
        "URLBASE" : (None, ),
        "INSTALLDIR" : (_browse_folder, )
    }

    def _clicked_cb(self, p):
         callback, = self.types[self.combo.get_active_text()]
         if callback:
             callback(self, p)

    def _changed_cb(self, p):
        self.update()

    def get_result(self):
        (type_, path) = (self.combo.get_active_text(), self.entry.get_text())
        if type_ not in ('FILE', 'DIR'):
            return (type_, path)
        # test existence
        if os.path.exists(path):
            return (type_, path)
        else:
            message = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION,
                                        buttons=gtk.BUTTONS_YES_NO,
                                        message_format=_("The path don't exists. Append it?"))
            message.set_title(_("No such path"))
            response = message.run()
            message.destroy()
            if response == gtk.RESPONSE_YES:
                return (type_, path)
        return None
开发者ID:aregee,项目名称:network-scanner,代码行数:87,代码来源:ScriptManager.py

示例4: PluginPage

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_sensitive [as 别名]

#.........这里部分代码省略.........

        self.p_window.animated_bar.start_animation(True)

        self.skip_install_btn.hide()
        self.install_updates_btn.hide()
        self.find_updates_btn.show()

        self.menu_enabled = True

    def __on_install_updates(self, widget):
        """
        Called when the user click on 'install updates' button

        This function call the start_download() of UpdateEngine
        and then add a timeout callback (__refresh_row_download) to
        update the gui at interval of 300 milliseconds.
        """

        lst = []
        for obj in self.p_window.update_eng.list:
            if obj.status != LATEST_GETTED:
                self.richlist.remove_row(obj.object)
                continue

            if obj.object.show_include:
                lst.append(obj)

            obj.object.show_include = False

            # Reset indexes
            obj.last_update_idx = 0
            obj.selected_update_idx = obj.object.versions_button.get_active()-1

        self.install_updates_btn.set_sensitive(False)
        self.skip_install_btn.set_sensitive(False)

        self.p_window.update_eng.list = lst
        self.p_window.update_eng.start_download()

        self.p_window.toolbar.show_message( \
            _("<b>Downloading updates ...</b>"), \
            file=os.path.join(Path.pixmaps_dir, "Throbber.gif") \
        )
        gobject.timeout_add(300, self.__refresh_row_download)

    def __refresh_row_download(self):
        """
        This is the timeout callback called to update the gui
        in the download phase (the last)
        """

        working = False

        for obj in self.p_window.update_eng.list:
            obj.lock.acquire()

            try:
                if obj.status == FILE_GETTING or \
                   obj.status == FILE_CHECKING:
                    working = True

                row = obj.object
                row.message = obj.label
                row.progress = obj.fract
            finally:
                obj.lock.release()
开发者ID:aregee,项目名称:network-scanner,代码行数:70,代码来源:PluginPage.py

示例5: NewInventory

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_sensitive [as 别名]
class NewInventory(HIGWindow):
    """
    A window for creating new or editing existing Inventories.
    """

    def __init__(self, inventory=None, edit_mode=False):
        """
        If you want to load an inventory at startup, pass it to inventory.
        If you want to run this in edit mode, set to True edit_mode.
        """
        HIGWindow.__init__(self)

        self.schemawin = None
        self.discoverywin = None
        self.edit_mode = edit_mode
        if edit_mode:
            self.wtitle = _("Editing Inventory")
        else:
            self.wtitle = _("New Inventory")

        # header
        self.title_markup = "<span size='16500' weight='heavy'>%s</span>"
        self.ttitle = HIGEntryLabel("")
        self.ttitle.set_line_wrap(False)
        self.ttitle.set_markup(self.title_markup % self.wtitle)
        self.umit_logo = gtk.Image()
        self.umit_logo.set_from_file(logo)
        # inventory
        self.invname_lbl = HIGEntryLabel(_("Inventory's name"))
        self.invname = gtk.Entry()
        self.invname.connect('changed', self._check_invname)
        self.invname_inuse = HIGEntryLabel(_("in use"))
        self.invname_inuse.set_sensitive(False)
        self.invenabled = gtk.CheckButton(_("Enabled"))
        self.invenabled.set_active(True)
        # scan command
        self.scandefault = gtk.CheckButton(_("Use default scan options"))
        img_info = gtk.Image()
        img_info.set_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_MENU)
        self.scandefault_tip = gtk.EventBox()
        self.scandefault_tip.add(img_info)

        self.scanadv = gtk.Expander(_("Use advanced scan options"))
        self.scan_name_lbl = HIGEntryLabel(_("Scan Profile"))
        self.scan_name = ProfileCombo()
        self.scan_name.update()
        self.scan_name.set_active(0)
        self.scan_name.connect('changed', self._set_scan_command)
        self.cmd_wizard = gtk.Button(stock=gtk.STOCK_CONVERT)
        blbl = self.cmd_wizard.get_children(
            )[0].get_children()[0].get_children()[1]
        blbl.set_text(_("Command Wizard"))
        self.cmd_wizard.connect('clicked', self._open_cmd_wizard)

        self.scan_command_lbl = HIGEntryLabel(_("Command"))
        self.scan_command = gtk.Entry()
        self.scan_command.connect('changed', self._set_scan_type)
        self._set_scan_command(None)
        self.scandefault.set_active(True)
        # scan target
        self.scantarget_lbl = HIGEntryLabel(_("Scan target"))
        self.scantarget = gtk.Entry()
        self.scantarget_discovery = HIGButton(_("Use host discovery"))
        self.scantarget_discovery.connect('clicked', self._open_host_discovery)
        # scheduling profiles
        self.sched_name_lbl = HIGEntryLabel(_("Scheduling Profile"))
        self.sched_name = gtk.combo_box_new_text()
        self.sched_name_edit = gtk.Button(stock=gtk.STOCK_EDIT)
        blbl = self.sched_name_edit.get_children(
            )[0].get_children()[0].get_children()[1]
        blbl.set_text(_("Edit Profiles"))
        self.sched_name_edit.connect('clicked', self._edit_schedprofiles)
        # bottom buttons
        self.help = HIGButton(stock=gtk.STOCK_HELP)
        self.help.connect('clicked', self._show_help)
        self.cancel = HIGButton(stock=gtk.STOCK_CANCEL)
        self.cancel.connect('clicked', self._exit)
        self.ok = HIGButton(stock=gtk.STOCK_OK)
        self.ok.connect('clicked', self._save_inventory_and_leave)

        self.tooltips = gtk.Tooltips()
        self.tooltips.set_tip(self.scandefault_tip,
            _("nmap -T Aggressive -sV -n -O -v target"))

        # disable controls if edit_mode=True
        if edit_mode:
            self.invname.set_sensitive(False)
            self.scandefault.set_sensitive(False)
            self.scandefault_tip.set_sensitive(False)
            self.scanadv.set_sensitive(False)
            self.scan_name.set_sensitive(False)
            self.scan_command.set_sensitive(False)
            self.scantarget_lbl.set_sensitive(False)
            self.scantarget.set_sensitive(False)
            self.scantarget_discovery.set_sensitive(False)

        self.connect('destroy', self._exit)
        self.profile_running = None # no SchedProfileEditor instance is running.
        self.load_schemas()
        self._load_pscheds()
#.........这里部分代码省略.........
开发者ID:aregee,项目名称:network-scanner,代码行数:103,代码来源:NewInventory.py

示例6: GeneralSettings

# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_sensitive [as 别名]

#.........这里部分代码省略.........

    def update_crash_report(self, widget):
        general_settings.crash_report = self.crash_report
    def update_splash(self, widget):
        general_settings.splash = self.splash
    def update_silent_root(self, widget):
        general_settings.silent_root = self.silent_root
    def update_log_file_text(self, widget):
        general_settings.log_file = self.log_file
    def update_log_file(self, widget):
        if not self.__log_file.get_active():
            self.__log_file_active(False)
        else:
            self.__log_file_active(True)
    def update_log(self, widget):
        """ Verify if is enable, if it is not enable nothing to do """
        if not widget.get_active():
            return
        # Widget is enable.
        ## But which is enable?

        # Setting kind of log
        if widget == self.__log_no:
            general_settings.log = "None"
        elif widget == self.__log_terminal:
            general_settings.log = "Debug"
        elif widget == self.__log_file:
            general_settings.log = "File"


    # API
    def get_splash(self):
        return self.__check_splash.get_active()
    def set_splash(self, splash):
        self.__check_splash.set_active(splash)

    def set_warnings_extensions(self, extensions):
        self.__check_warning_extensions.set_active(extensions)
    def get_warnings_extensions(self):
        return self.__check_warning_extensions.get_active()
    def set_silent_root(self, root):
        self.__check_silent_root.set_active(root)
    def get_silent_root(self):
        return self.__check_silent_root.get_active()


    def set_crash_report(self, crash):
        self.__crash_report.set_active(crash)
    def get_crash_report(self):
        return self.__crash_report.get_active()

    def get_log(self):
        """
        filter a str with None, Debug or File
        return: int (means 0 - No debug, 1 - debug, 2 - debug file)
        """
        if self.__log_no.get_active():
            return "None"
        elif self.__log_terminal.get_active():
            return "Debug"
        elif self.__log_file.get_active():
            return "File"
        else:
            raise LogException()



    def set_log(self, log):
        if log == "None":
            self.__log_no.set_active(True)
        elif log == "Debug":
            self.__log_terminal.set_active(True)
        elif log == "File":
            self.__log_file.set_active(True)


    def __log_file_active(self, bool):
        self.__log_file_label.set_sensitive(bool)
        self.__log_file_entry.set_sensitive(bool)
        self.__log_file_browser.set_sensitive(bool)

    def set_log_file(self, filename):
        self.__log_file_entry.set_text(filename)
    def get_log_file(self):
        return self.__log_file_entry.get_text()

    def set_warnings_save(self, save):
        self._warnings_save.set_active(save)
    def get_warnings_save(self):
        return self._warnings_save.get_active()

    # Propertys
    splash = property(get_splash, set_splash)
    warnings_extensions = property(get_warnings_extensions, \
                                   set_warnings_extensions)
    silent_root = property(get_silent_root, set_silent_root)
    crash_report = property(get_crash_report, set_crash_report)
    log = property(get_log, set_log)
    log_file = property(get_log_file, set_log_file)
    warnings_save = property(get_warnings_save, set_warnings_save)
开发者ID:aregee,项目名称:network-scanner,代码行数:104,代码来源:GeneralSettings.py


注:本文中的higwidgets.higbuttons.HIGButton.set_sensitive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。