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


Python I18N._函数代码示例

本文整理汇总了Python中umit.core.I18N._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _run_inv_scan

    def _run_inv_scan(self, widget, inv):
        """
        Run Inventory scan.
        """
        if self.daddy:
            inv_id = self.daddy.invdb.get_inventory_id_for_name(inv)
            if not inv_id:

                scan_args = self._get_command_from_schemas(inv)
                if not scan_args:
                    return

            else:
                scan_args = (
                    self.daddy.invdb.get_scan_args_for_inventory_id(inv_id))
                if not scan_args:
                    scan_args = self._get_command_from_schemas(inv)
                    if not scan_args:
                        return


            scan = NmapCommand(scan_args)
            scan.run_scan()

            if not self.running_scans:
                # no scans running, start timer for checking if some scan
                # finished
                self.scans_timer = gobject.timeout_add(4200, self._check_scans)

            self.running_scans[scan] = inv
            running_scans = len(self.running_scans)
            self.daddy._write_statusbar(("%d " % running_scans) +
                    append_s(_("scan"), running_scans) + _(" running"))
开发者ID:aregee,项目名称:network-scanner,代码行数:33,代码来源:InventoryTree.py

示例2: set_osclass

 def set_osclass(self, osclass=None):
     child = self.osclass_expander.get_child()
     if child is not None:
         self.osclass_expander.remove(child)
     
     if osclass is None:
         self.osclass_expander.set_sensitive(False)
         return
     else:
         self.osclass_expander.set_sensitive(True)
         self.osclass_expander.set_use_markup(True)
         table, hbox = self.create_table_hbox()
         
         table.attach(HIGEntryLabel(_('Type')),0,1,0,1)
         table.attach(HIGEntryLabel(_('Vendor')),1,2,0,1)
         table.attach(HIGEntryLabel(_('OS Family')),2,3,0,1)
         table.attach(HIGEntryLabel(_('OS Generation')),3,4,0,1)
         table.attach(HIGEntryLabel(_('Accuracy')),4,5,0,1)
         
         y1=1;y2=2
         
         for o in osclass:
             table.attach(HIGEntryLabel(o['type']),0,1,y1,y2)
             table.attach(HIGEntryLabel(o['vendor']),1,2,y1,y2)
             table.attach(HIGEntryLabel(o['osfamily']),2,3,y1,y2)
             table.attach(HIGEntryLabel(o.get('osgen', '')),3,4,y1,y2)
             
             progress = gtk.ProgressBar()
             progress.set_text(o['accuracy']+'%')
             progress.set_fraction(float(o['accuracy'])/100.0)
             table.attach(progress,4,5,y1,y2)
             y1+=1;y2+=1
         
         self.osclass_expander.add(hbox)
开发者ID:aregee,项目名称:network-scanner,代码行数:34,代码来源:ScanHostDetailsPage.py

示例3: get_networks

    def get_networks(self, event):
        """
        Try to detect network(s).
        """
        networks = tryto_detect_networks()

        if not networks:
            dlg = HIGAlertDialog(self,
                message_format=_("No network(s) detected."),
                secondary_text=_("You will need to especify the "
                    "network(s) yourself before detecting hosts."))
            dlg.run()
            dlg.destroy()
            return

        entries = len(self.networks_box.get_children()) - 1

        for amount, nw in enumerate(networks):
            if amount == entries:
                e = gtk.Entry()
                e.set_text('')
                e.show()
                self.networks_box.add(e)
                entries += 1

            entry = self.networks_box.get_children()[amount]
            entry.set_text(nw.cidr_netaddress())
开发者ID:aregee,项目名称:network-scanner,代码行数:27,代码来源:HostDiscovery.py

示例4: __init__

    def __init__(self):
        """
        """
        super(SaveDialog, self).__init__(
            title=_("Save Topology"),
            action=gtk.FILE_CHOOSER_ACTION_SAVE,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK),
        )

        self.__combo = gtk.combo_box_new_text()

        types_list = TYPES.keys()
        types_list.sort()

        for i in types_list:
            self.__combo.append_text(i)

        self.__combo.set_active(1)
        self.__label = HIGLabel(_("Select the output type:"))

        self.__hbox = HIGHBox()
        self.__hbox._pack_noexpand_nofill(self.__label)
        self.__hbox._pack_expand_fill(self.__combo)

        self.set_extra_widget(self.__hbox)
        self.set_do_overwrite_confirmation(True)

        self.__hbox.show_all()
开发者ID:tianweidut,项目名称:network-scanner,代码行数:28,代码来源:SaveDialog.py

示例5: invcombo

    def invcombo(self):
        """
        Creates and return a ToolItem with a combobox with a full listing
        of Inventories.
        """
        align = gtk.Alignment(0, 0.5, 0, 1)
        align.set_padding(0, 0, 6, 0)
        cbinv = gtk.combo_box_new_text()
        align.add(cbinv)

        cbinv.append_text(_("Search in"))
        cbinv.append_text(_("All Inventories"))
        cbinv.set_active(1)
        cbinv.connect('changed', self._change_inventory)
        self.inventory_list.append(_("Search in"))
        self.inventory_list.append(_("All Inventories"))

        self.inventory = cbinv.get_active_text()

        item = gtk.ToolItem()
        item.add(align)

        if not self.invdb:
            return item

        for invid, invname in self.invdb.get_inventories_ids_names():
            cbinv.append_text('%s' % invname)
            self.inventory_list.append(invname)

        return item
开发者ID:aregee,项目名称:network-scanner,代码行数:30,代码来源:SearchBar.py

示例6: __init__

 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()
开发者ID:aregee,项目名称:network-scanner,代码行数:28,代码来源:ScriptManager.py

示例7: __pack_widgets

    def __pack_widgets(self):
        self.add(self.vbox)

        self.vbox.pack_start(self.animated_bar, False, False, 0)
        self.vbox.pack_start(self.toolbar, False, False, 0)
        self.vbox.pack_start(self.notebook)

        self.notebook.append_page(self.plug_page)
        self.notebook.append_page(self.path_page)

        self.toolbar.connect('changed', self.__on_switch_page)

        self.connect('realize', self.__on_realize)

        # Create the pages

        lbls = (_('Extensions'), _('Paths'))
        imgs = ('extension_small', 'paths_small')

        for lbl, stock in zip(lbls, imgs):
            image = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU)

            self.toolbar.append(
                HIGToolItem('<b>%s</b>' % lbl, image)
            )

        self.toolbar.set_active(0)
        self.get_child().show_all() # No show the root

        # We have to hide unused buttons in plugin page
        self.plug_page.install_updates_btn.hide()
        self.plug_page.skip_install_btn.hide()
        self.plug_page.restart_btn.hide()

        self.connect('delete-event', self.__on_delete_event)
开发者ID:aregee,项目名称:network-scanner,代码行数:35,代码来源:Window.py

示例8: create_widgets

    def create_widgets(self):
        vbox = HIGVBox()

        self.btn_internal = gtk.RadioButton(None, _("Internal Editor"))
        vbox.pack_start(self.btn_internal, False, False)

        self.btn_external = gtk.RadioButton(self.btn_internal, _("External Editor"))
        vbox.pack_start(self.btn_external, False, False)

        self.external_cmd = gtk.Entry()
        self.external_cmd.set_text(self.preferences.external_command)
        vbox.pack_start(HIGSpacer(self.external_cmd), False, False)

        self.btn_external.connect("toggled",
                                  lambda b: self._update_use_editor())
	
	self.external_cmd.connect("focus-out-event",
                                       self._update_external_command)

        if self.preferences.use_internal_editor:
            self.btn_internal.set_active(True)
            self.external_cmd.set_sensitive(False)
        else:
            self.btn_external.set_active(True)
            self.external_cmd.set_sensitive(True)
        
        self.pack_start(HIGSpacer(vbox), False, False)
开发者ID:aregee,项目名称:network-scanner,代码行数:27,代码来源:ScriptManager.py

示例9: __create_widgets

    def __create_widgets(self):
        self.vbox = HIGVBox()
        self.hbox = HIGHBox()
        self.img_logo = gtk.Image()
        self.event_img_logo = gtk.EventBox()
        self.img = 1
        
        self.d = {}
        for c in (65, 97):
            for i in range(26):
                self.d[chr(i+c)] = chr((i+13) % 26 + c)
        
        self.lbl_program_version = gtk.Label("""\
<span size='30000' weight='heavy'>Umit %s</span>""" % VERSION)
        
        self.lbl_program_description = gtk.Label(\
            _("""Umit is network scanning frontend,
developed in PyGTK by Adriano Monteiro 
Marques <[email protected]>
and was sponsored by Google during the
Summer of Code 2005, 2006, 2007, 2008 and 2009. Thanks Google!"""))
        
        self.lbl_copyright=gtk.Label("<small>Copyright (C) 2005-2006 \
Insecure.Com LLC. and (C) 2007-2009 Adriano Monteiro Marques</small>")
        
        self.lbl_program_website = gtk.Label(\
            "<span underline='single' \
            foreground='blue'>http://www.umitproject.org</span>")
        
        self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
        self.btn_credits = HIGButton(_("Credits"))
开发者ID:aregee,项目名称:network-scanner,代码行数:31,代码来源:About.py

示例10: open_file

    def open_file (self, widget):
        file_chooser = ResultsFileChooserDialog(_("Select Scan Result"))
        
        file_chooser.run()
        file_chosen = file_chooser.get_filename()
        file_chooser.destroy()

        if check_access(file_chosen, os.R_OK):
            try:
                parser = NmapParser(file_chosen)
                parser.parse()
            except:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % _('File is not a Umit \
Scan Result'),
                    secondary_text=_("Selected file is not a Umit Scan \
Result file. Umit can not parse this file. Please, select another."))
                alert.run()
                alert.destroy()
                return False

            scan_name = os.path.split(file_chosen)[-1]
            self.add_scan(scan_name, parser)
            
            self.combo_scan.set_active(len(self.list_scan) - 1)
        else:
            alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % \
                                   _('Can not open selected file'),
                    secondary_text=_("Umit can not open selected file. Please, \
select another."))
            alert.run()
            alert.destroy()
开发者ID:aregee,项目名称:network-scanner,代码行数:33,代码来源:DiffCompare.py

示例11: __on_skip_updates

    def __on_skip_updates(self, widget):
        "Called when the user click on the skip button"

        # We need to repopulate the tree
        self.richlist.clear()
        self.populate()

        self.p_window.toolbar.unset_status()

        if self.restart_btn.flags() & gtk.VISIBLE:
            # That callback is called from a self.___on_install_updates

            self.restart_btn.hide()
            self.p_window.animated_bar.label = \
                _('Rembember to restart UMIT to use new version of plugins.')

        else:
            self.p_window.animated_bar.label = \
                    _('Update skipped')

        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
开发者ID:aregee,项目名称:network-scanner,代码行数:27,代码来源:PluginPage.py

示例12: fingerprint_diff

    def fingerprint_diff(self, up_old, up_new, ts_old, ts_new, tts_old,
        tts_new, iis_old, iis_new, diff=True):
        """
        Do fingerprint diff.
        """
        
        if not diff:
            status = "Added"
        elif (up_old != up_new) or (ts_old != ts_new) or (tts_old != tts_new) \
            or (iis_old != iis_new):
            status = "Modified"
        else:
            status = "Unchanged"

        r = self.diff_tree.append(None, [status[0], _("Fingerprint"), "", "",
            "", self.colors.get_hex_color(status[0])])
        # Uptime
        self.std_diff(up_old, up_new, _("Uptime"), diff, r)

        # TCP Sequence
        self.std_diff(ts_old, ts_new, _("TCP Sequence"), diff, r)

        # TCP TS Sequence
        self.std_diff(tts_old, tts_new, _("TCP TS Sequence"), diff, r)

        # IP ID Sequence
        self.std_diff(iis_old, iis_new, _("IP ID Sequence"), diff, r)
开发者ID:aregee,项目名称:network-scanner,代码行数:27,代码来源:ChangesDiff.py

示例13: extraports_diff

    def extraports_diff(self, ep_o, ep_n, diff=True):
        """
        Do extraports diff.
        """
        if not diff:
            status = "Added"
            ep_o = ep_n
        elif ep_o != ep_n:
            status = "Modified"
        else:
            status = "Unchanged"

        r = self.diff_tree.append(None, [status[0], _("Extraports"), "", "",
            "", self.colors.get_hex_color(status[0])])

        for key, values in ep_o.items():
            if key in ep_n:
                new_value = ep_n[key]
            else:
                new_value = NA

            d_temp = {_('count'): values}
            dn_temp = {_('count'): new_value}
            self.std_diff(d_temp, dn_temp, key, diff, r)

        if not diff:
            # Job is complete here if diff=False
            return

        for key, values in ep_n.items():
            if key in ep_o:
                continue

            d_temp = {_('count'): values}
            self.std_diff(d_temp, d_temp, key, False, r)
开发者ID:aregee,项目名称:network-scanner,代码行数:35,代码来源:ChangesDiff.py

示例14: set_scan_infos

 def set_scan_infos(self, scan_info):
     for scan in scan_info:
         exp = gtk.Expander('<b>%s - %s</b>' % (_('Scan Info'),
                                                scan['type'].capitalize()))
         exp.set_use_markup(True)
         hbox = HIGHBox()
         table = HIGTable()
         table.set_border_width(5)
         table.set_row_spacings(6)
         table.set_col_spacings(6)
         
         table.attach(HIGEntryLabel(_('Scan type:')),0,1,0,1)
         table.attach(HIGEntryLabel(scan['type']),1,2,0,1)
         
         table.attach(HIGEntryLabel(_('Protocol:')),0,1,1,2)
         table.attach(HIGEntryLabel(scan['protocol']),1,2,1,2)
         
         table.attach(HIGEntryLabel(_('# scanned ports:')),0,1,2,3)
         table.attach(HIGEntryLabel(scan['numservices']),1,2,2,3)
         
         table.attach(HIGEntryLabel(_('Services:')),0,1,3,4)
         table.attach(self.get_service_view(scan['services'].split(',')),\
                                            1,2,3,4)
         
         hbox._pack_noexpand_nofill(hig_box_space_holder())
         hbox._pack_noexpand_nofill(table)
         
         exp.add (hbox)
         self._pack_noexpand_nofill(exp)
开发者ID:aregee,项目名称:network-scanner,代码行数:29,代码来源:ScanRunDetailsPage.py

示例15: _create_columns

    def _create_columns(self):
        """
        Create TreeView columns.
        """
        columns = (
            (_("Inventory"), 0), (_("Host address"), 0),
            (_("Category"), 0), (_("Short change description"), 400),
            (_("Change date"), 0)
            )

        self.tview.columns = [None]*self.tcolumns

        start = len(columns) - self.tcolumns

        # remove previous columns if any
        for column in self.tview.get_columns():
            self.tview.remove_column(column)

        for i in range(self.tcolumns):
            column = columns[i + start]

            self.tview.columns[i] = gtk.TreeViewColumn(column[0])

            if column[1]: # minimum size
                self.tview.columns[i].set_min_width(column[1])
开发者ID:aregee,项目名称:network-scanner,代码行数:25,代码来源:ChangesList.py


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