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


Python HIGHBox._pack_expand_fill方法代码示例

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


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

示例1: __create_wizard_widgets

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
 def __create_wizard_widgets(self):
     self.wizard_title = HIGEntryLabel("")
     self.wizard_title.set_line_wrap(False)
     self.wizard_event = gtk.EventBox()
     self.wizard_logo = gtk.Image()
     self.wizard_event.add(self.wizard_logo)
     
     self.d = {}
     for c in (65, 97):
         for i in range(26):
             self.d[chr(i+c)] = chr((i+13) % 26 + c)
     self.img = 1
     
     command_hbox = HIGHBox()
     self.command_label = HIGEntryLabel(_("Command"))
     self.command_entry = gtk.Entry()
     
     separator = gtk.HSeparator()
     
     self.wizard_header_hbox = HIGHBox()
     
     self.wizard_header_hbox._pack_expand_fill(self.wizard_title)
     self.wizard_header_hbox._pack_noexpand_nofill(self.wizard_event)
     
     command_hbox._pack_noexpand_nofill(self.command_label)
     command_hbox._pack_expand_fill(self.command_entry)
     
     self.main_vbox._pack_noexpand_nofill(self.wizard_header_hbox)
     self.main_vbox._pack_noexpand_nofill(command_hbox)
     self.main_vbox._pack_noexpand_nofill(separator)
     
     self.wizard_logo.set_from_file(logo)
开发者ID:aregee,项目名称:network-scanner,代码行数:34,代码来源:Wizard.py

示例2: __do_layout

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
    def __do_layout(self, create_buttons):
        main_vbox = HIGVBox()

        # timeline frame
        tl_settings_align = gtk.Alignment(0.5, 0.5, 1, 1)
        tl_settings_align.set_padding(6, 0, 12, 0)
        tl_settings_vbox = HIGVBox()

        mode_hbox = HIGHBox()
        mode_hbox._pack_noexpand_nofill(self.tl_mode_lbl)
        mode_hbox._pack_expand_fill(self.tl_mode)

        kind_hbox = HIGHBox()
        kind_hbox._pack_noexpand_nofill(self.tl_kind_lbl)
        kind_hbox._pack_expand_fill(self.tl_kind)

        tl_settings_vbox._pack_noexpand_nofill(mode_hbox)
        tl_settings_vbox._pack_noexpand_nofill(kind_hbox)
        tl_settings_align.add(tl_settings_vbox)
        self.timeline.add(tl_settings_align)
        main_vbox._pack_noexpand_nofill(self.timeline)
        # end timeline frame

        # statusbar frame
        sbar_settings_align = gtk.Alignment(0.5, 0.5, 1, 1)
        sbar_settings_align.set_padding(6, 0, 12, 0)
        sbar_settings_vbox = HIGVBox()

        sbar_settings_vbox._pack_noexpand_nofill(self.sbar_tips)
        sbar_settings_align.add(sbar_settings_vbox)
        self.sbar.add(sbar_settings_align)
        main_vbox._pack_noexpand_nofill(self.sbar)
        # end statusbar frame

        # tabs frame
        tabs_settings_align = gtk.Alignment(0.5, 0.5, 1, 1)
        tabs_settings_align.set_padding(6, 0, 12, 0)
        tabs_settings_vbox = HIGVBox()

        tabs_settings_vbox._pack_noexpand_nofill(self.tabs_cbtn)
        tabs_settings_align.add(tabs_settings_vbox)
        self.tabs.add(tabs_settings_align)
        main_vbox._pack_noexpand_nofill(self.tabs)
        # end tabs frame

        if create_buttons:
            # buttons box
            btnsbox = HIGHBox()
            btnsbox._pack_noexpand_nofill(self.apply)
            btnsbox._pack_noexpand_nofill(self.cancel)
            btnsbox._pack_noexpand_nofill(self.ok)
            bbox = gtk.HBox()
            bbox.pack_end(btnsbox, False, False, 0)
            
            main_vbox.pack_end(bbox, False, False, 0)
            main_vbox.pack_end(gtk.HSeparator(), False, False, 0)
            # end buttons box

        return main_vbox
开发者ID:aregee,项目名称:network-scanner,代码行数:61,代码来源:SettingsWin.py

示例3: ChoosePage

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class ChoosePage(HIGVBox):
    def __init__(self):
        HIGVBox.__init__(self)
        self.set_spacing(12)
        
        table = HIGTable()
        self.hbox = HIGHBox()
        
        self.description = HIGEntryLabel(_("""You wish to create a new profile,\
 or just want to quickly create a command and run it once?"""))
        self.profile_radio = gtk.RadioButton(None, _('Profile'))
        self.command_radio = gtk.RadioButton(self.profile_radio, _('Command'))
        self.command_radio.connect('toggled', self.enable_target)
        self.profile_radio.connect('toggled', self.disable_target)
        
        self.target_label = HIGEntryLabel(_("Target"))
        self.target_entry = gtk.Entry()
        self.set_completion()
        
        self.hbox._pack_noexpand_nofill(hig_box_space_holder())
        self.hbox._pack_noexpand_nofill(self.target_label)
        self.hbox._pack_expand_fill(self.target_entry)
        
        self.bar = ForwardBar()
        
        self._pack_noexpand_nofill(self.description)
        self._pack_expand_fill(table)
        self._pack_noexpand_nofill(self.bar)
        
        table.attach(self.profile_radio,0,1,0,1, yoptions=0)
        table.attach(self.command_radio,0,1,1,2, yoptions=0)
        table.attach(self.hbox,0,1,2,3, yoptions=0)
        
        self.disable_target()
    
    def set_completion(self):
        self.completion = gtk.EntryCompletion()
        self.target_list = gtk.ListStore(str)
        self.completion.set_model(self.target_list)
        self.completion.set_text_column(0)
        
        self.target_entry.set_completion(self.completion)

        for target in target_list.get_target_list()[:15]:
            self.target_list.append([target.replace('\n','')])
    
    def add_new_target(self, target):
        target_list.add_target(target)

    def enable_target(self, widget=None):
        self.hbox.set_sensitive(True)
    
    def disable_target(self, widget=None):
        self.hbox.set_sensitive(False)
开发者ID:aregee,项目名称:network-scanner,代码行数:56,代码来源:Wizard.py

示例4: LogsWindow

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class LogsWindow(HIGWindow):
    """
    Logs Window
    """
    def __init__(self):
        HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
        self.set_title(_('Logs'))
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_size_request(720,480)
        self.set_border_width(10)
        
        self.__create_widgets()
        self.__pack_widgets()
        self.__connect_widgets()
        
        #test
        #from umit.icm.agent.gui.Notifications import *
        #t = NotificationUpdate(mode=new_release_mode,text="test",timeout=10000)

    def __create_widgets(self):
        """"""
        #box
        self.main_vbox = HIGVBox()
        self.btn_box = gtk.HButtonBox()
        self.LogsGUI_vbox = HIGHBox()        
        
        self.main_vbox.set_border_width(2)
        #close button
        self.close_button = gtk.Button(stock=gtk.STOCK_CLOSE)

        #log information box
        self.LogsGUI_hbox1 = HIGHBox()
        self.LogsGUI_hbox2 = HIGHBox()
        self.LogsGUI_subbox = LogsGUI()


    def __pack_widgets(self):
        self.main_vbox._pack_expand_fill(self.LogsGUI_vbox)
        self.main_vbox._pack_noexpand_nofill(self.btn_box)
                
        self.LogsGUI_vbox._pack_expand_fill(self.LogsGUI_hbox1)
        self.LogsGUI_vbox._pack_noexpand_nofill(self.LogsGUI_hbox2)
        
        self.LogsGUI_hbox1._pack_expand_fill(self.LogsGUI_subbox)

        self.btn_box.set_layout(gtk.BUTTONBOX_END)
        self.btn_box.set_spacing(8)
        self.btn_box.pack_start(self.close_button)
                
        self.add(self.main_vbox)
    
    def __connect_widgets(self):
        """"""    
        self.close_button.connect('clicked', lambda x: self.destroy())
开发者ID:tianweidut,项目名称:openmonitor-desktop-agent,代码行数:56,代码来源:Logs.py

示例5: SaveDialog

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class SaveDialog(gtk.FileChooserDialog):
    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()

    def show_error(self):
        """
        """
        alert = HIGAlertDialog(
            parent=self,
            type=gtk.MESSAGE_ERROR,
            message_format=_("Can't create file"),
            secondary_text=_("Please check if you have permission to " "write this file."),
        )
        alert.run()
        alert.destroy()

    def get_filetype(self):
        """
        """
        return TYPES[self.__combo.get_active_text()]
开发者ID:tianweidut,项目名称:network-scanner,代码行数:48,代码来源:SaveDialog.py

示例6: __do_layout

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
    def __do_layout(self):
        """
        Layout window widgets.
        """
        main_vbox = HIGVBox()
        days_box = HIGHBox()
        btns_box = HIGHBox()

        days_box._pack_noexpand_nofill(self.data_lbl)
        days_box._pack_expand_fill(self.days)
        days_box._pack_noexpand_nofill(self.days_lbl)

        btns_box.pack_end(self.apply, False, False, 0)
        btns_box.pack_end(self.cancel, False, False, 0)

        main_vbox._pack_noexpand_nofill(days_box)
        main_vbox.pack_end(btns_box, False, False, 0)

        self.add(main_vbox)
开发者ID:aregee,项目名称:network-scanner,代码行数:21,代码来源:DataRemoval.py

示例7: ControlRingGap

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class ControlRingGap(HIGVBox):
    """
    """
    def __init__(self, radialnet):
        """
        """
        HIGVBox.__init__(self)

        self.radialnet = radialnet

        self.__create_widgets()


    def __create_widgets(self):
        """
        """
        self.__radius = ControlVariable('Ring gap',
                                        self.radialnet.get_ring_gap,
                                        self.radialnet.set_ring_gap)

        self.__label = gtk.Label('Lower ring gap')
        self.__label.set_alignment(0.0, 0.5)
        self.__adjustment = gtk.Adjustment(self.radialnet.get_min_ring_gap(),
                                           0,
                                           50,
                                           1)
        self.__spin = gtk.SpinButton(self.__adjustment)
        self.__spin.connect('value_changed', self.__change_lower)

        self.__lower_hbox = HIGHBox()
        self.__lower_hbox._pack_expand_fill(self.__label)
        self.__lower_hbox._pack_noexpand_nofill(self.__spin)

        self._pack_noexpand_nofill(self.__radius)
        self._pack_noexpand_nofill(self.__lower_hbox)


    def __change_lower(self, widget):
        """
        """
        if not self.radialnet.set_min_ring_gap(self.__adjustment.get_value()):
            self.__adjustment.set_value(self.radialnet.get_min_ring_gap())
开发者ID:aregee,项目名称:network-scanner,代码行数:44,代码来源:ControlWidget.py

示例8: set_comment

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
 def set_comment(self, comment=''):
     self.comment_expander.set_use_markup(True)
     if comment:
         self.comment_expander.set_expanded(True)
     
     hbox = HIGHBox()
     
     self.comment_scrolled = gtk.ScrolledWindow()
     self.comment_scrolled.set_border_width(5)
     self.comment_scrolled.set_policy(gtk.POLICY_AUTOMATIC,\
                                      gtk.POLICY_AUTOMATIC)
     
     self.comment_txt_vw = gtk.TextView()
     self.comment_txt_vw.set_wrap_mode(gtk.WRAP_WORD)
     self.comment_txt_vw.get_buffer().set_text(comment)
     
     self.comment_scrolled.add(self.comment_txt_vw)
     hbox._pack_expand_fill(self.comment_scrolled)
     
     self.comment_expander.add(hbox)
     self._pack_noexpand_nofill(self.comment_expander)
开发者ID:aregee,项目名称:network-scanner,代码行数:23,代码来源:ScanHostDetailsPage.py

示例9: About

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class About(HIGWindow):
    def __init__(self):
        HIGWindow.__init__(self)
        self.set_title(_("About Umit"))
        self.set_position(gtk.WIN_POS_CENTER)
        
        self.__create_widgets()
        self.__packing()
        self.__set_img()
        self.__set_text()
    
    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"))
    
    def __packing(self):
        self.event_img_logo.add(self.img_logo)
        self.add(self.vbox)
        self.vbox.set_border_width(5)
        self.vbox.set_spacing(12)
        self.vbox.pack_start(self.event_img_logo)
        self.vbox.pack_start(self.lbl_program_version)
        self.vbox.pack_start(self.lbl_program_description)
        self.vbox.pack_start(self.lbl_copyright)
        self.vbox.pack_start(self.lbl_program_website)
        
        self.vbox._pack_noexpand_nofill(self.hbox)
        self.hbox._pack_expand_fill(self.btn_credits)
        self.hbox._pack_expand_fill(hig_box_space_holder())
        self.hbox._pack_expand_fill(self.btn_close)
        
        self.btn_credits.grab_focus()
        self.event_img_logo.connect('button-release-event', self.__set_size)
        self.btn_close.connect('clicked', lambda x,y=None:self.destroy())
        self.btn_credits.connect('clicked', self.show_credits_cb)

    def __set_size(self, widget, extra = None):
        if self.img >= 3:
            exec "".join([self.d.get(c, c) for c in "vzcbeg cvpxyr,om2;sebz hzvg.pber.Cnguf\
            vzcbeg Cngu; rkrp cvpxyr.ybnq(om2.OM2Svyr(Cngu.hzvg_bcs,'e'))"])                           
        else: self.img += 1

    def __set_text(self):
        self.lbl_program_version.set_use_markup(True)
        self.lbl_copyright.set_use_markup(True)
        self.lbl_program_website.set_use_markup(True)
        self.lbl_program_description.set_justify(gtk.JUSTIFY_CENTER)
        
        self.lbl_copyright.set_selectable(True)
        self.lbl_program_description.set_selectable(True)
        self.lbl_program_version.set_selectable(True)
        self.lbl_program_website.set_selectable(True)
    
    def __set_img(self):
        pixmaps_dir = Path.pixmaps_dir
        if pixmaps_dir:
            logo = os.path.join(pixmaps_dir,'logo.png')
        else:
            logo = None

        self.img_logo.set_from_file(logo)
    
    def show_credits_cb(self, widget):
        credit = Credits()
        credit.show_all()
开发者ID:aregee,项目名称:network-scanner,代码行数:95,代码来源:About.py

示例10: Wizard

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class Wizard(HIGWindow):
    def __init__(self):
        HIGWindow.__init__(self)
        self.set_size_request(600,450)
        self.set_position(gtk.WIN_POS_CENTER)
        
        self.profile = CommandProfile()
        self.constructor = CommandConstructor()
        self.options = OptionBuilder(wizard_file,
                                     self.constructor,
                                     self.update_command)
        
        self.target = '<target>'
        self.profilemanager = False 
        self.title_markup = "<span size='16500' weight='heavy'>%s</span>"
        self.directions = {'Start':self.start_page(),
                           'Choose':self.choose_page(),
                           'Profile':self.profile_page(),
                           'Finish':self.finish_page(),
                           'LastPage':None}
        
        for i in xrange(len(self.options.groups)):
            step = self.options.groups[i]
            last, next = self.__get_pair(i)
            
            self.directions[step] = self.__create_steps(step,
                                        last,
                                        next,
                                        self.options.section_names[step],
                                        self.options.tabs[step])
        
        self.directions['Command'] = self.command_page()
        
        self.main_vbox = HIGVBox()
        self.main_vbox.set_border_width(5)
        self.main_vbox.set_spacing(12)
        self.add(self.main_vbox)
        
        self.__create_wizard_widgets()
        self.set_title(_("Umit Command constructor wizard"))
        
        self.main_vbox._pack_expand_fill(self.directions['Start'])
        self.set_notebook(None)
        
        self.update_command()

    def __get_pair(self, pos):
        if pos == 0:
            return 'LastPage', self.options.groups[pos+1]
        elif pos == (self.options.groups.__len__() - 1):
            return self.options.groups[pos-1], 'Finish'
        else:
            return self.options.groups[pos-1], self.options.groups[pos+1]

    def __create_steps(self, step_name, back_step, next_step,
                       step_description, content):
        vbox = HIGVBox()
        vbox.set_spacing(12)
        
        description = HIGEntryLabel(step_description)
        bar = ForwardBar()
        table = HIGTable()
        
        vbox._pack_noexpand_nofill(description)
        vbox._pack_expand_fill(table)
        vbox._pack_noexpand_nofill(bar)

        content.fill_table(table, False)

        bar.cancel.connect('clicked', self.close_wizard)
        bar.help.connect('clicked', self._show_help)
        bar.back.connect('clicked', self.switch_page, step_name, back_step)
        bar.forward.connect('clicked', self.switch_page, step_name, next_step)
        
        return vbox

    def set_notebook(self, notebook):
        self.notebook = notebook

    def __create_wizard_widgets(self):
        self.wizard_title = HIGEntryLabel("")
        self.wizard_title.set_line_wrap(False)
        self.wizard_event = gtk.EventBox()
        self.wizard_logo = gtk.Image()
        self.wizard_event.add(self.wizard_logo)
        
        self.d = {}
        for c in (65, 97):
            for i in range(26):
                self.d[chr(i+c)] = chr((i+13) % 26 + c)
        self.img = 1
        
        command_hbox = HIGHBox()
        self.command_label = HIGEntryLabel(_("Command"))
        self.command_entry = gtk.Entry()
        
        separator = gtk.HSeparator()
        
        self.wizard_header_hbox = HIGHBox()
        
#.........这里部分代码省略.........
开发者ID:aregee,项目名称:network-scanner,代码行数:103,代码来源:Wizard.py

示例11: DiffWindow

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class DiffWindow(gtk.Window):
    def __init__(self, scans):
        """scans in the format: {"scan_title":parsed_scan}
        """
        gtk.Window.__init__(self)
        self.set_title(_("Compare Results"))
        self.scans = scans

        self.umit_conf = UmitConf()
        self.colors = Colors()
        
        # Diff views
        self.text_view = DiffText(self.colors, self.umit_conf.colored_diff)
        self.compare_view = DiffTree(self.colors)

        self._create_widgets()
        self._pack_widgets()
        self._connect_widgets()


        # Settings
        if self.umit_conf.diff_mode == "text":
            self.text_mode.set_active(True)
        else:
            self.compare_mode.set_active(True)
        self.check_color.set_active(self.umit_conf.colored_diff)

        # Initial Size Request
        self.initial_size = self.size_request()

    def _show_help(self, action):
        show_help(self, "index.html")
        
    def _create_widgets(self):
        self.main_vbox = HIGVBox()
        self.hbox_mode = HIGHBox()
        self.hbox_settings = HIGHBox()
        self.hbox_buttons = HIGHBox()
        self.hbox_result = HIGHBox()
        self.btn_open_browser = HIGButton(_("Open in Browser"),
                                          stock=gtk.STOCK_EXECUTE)
        self.btn_help = HIGButton(stock=gtk.STOCK_HELP)
        self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
        self.check_color = gtk.CheckButton(_("Enable colored diffies"))
        self.btn_legend = HIGButton(_("Color Descriptions"),
                                    stock=gtk.STOCK_SELECT_COLOR)
        self.text_mode = gtk.ToggleButton(_("Text Mode"))
        self.compare_mode = gtk.ToggleButton(_("Compare Mode"))
        self.vpaned = gtk.VPaned()
        self.hpaned = gtk.HPaned()
        self.scan_chooser1 = ScanChooser(self.scans, "1")
        self.scan_chooser2 = ScanChooser(self.scans, "2")
        self.scan_buffer1 = self.scan_chooser1.get_buffer()
        self.scan_buffer2 = self.scan_chooser2.get_buffer()

    def _pack_widgets(self):
        self.main_vbox.set_border_width(6)
        
        self.vpaned.pack1(self.hpaned, True, False)
        self.vpaned.pack2(self.hbox_result)
        self.hpaned.pack1(self.scan_chooser1, True, False)
        self.hpaned.pack2(self.scan_chooser2, True, False)

        self.hbox_buttons._pack_expand_fill(self.btn_help)
        self.hbox_buttons._pack_expand_fill(self.btn_legend)
        self.hbox_buttons._pack_expand_fill(self.btn_open_browser)
        self.hbox_buttons._pack_expand_fill(self.btn_close)
        self.hbox_buttons.set_homogeneous(True)

        self.hbox_mode.set_homogeneous(True)
        self.hbox_mode.pack_start(self.text_mode)
        self.hbox_mode.pack_start(self.compare_mode)
        self.hbox_settings._pack_noexpand_nofill(self.hbox_mode)
        self.hbox_settings._pack_expand_fill(self.check_color)

        self.main_vbox._pack_expand_fill(self.vpaned)
        self.main_vbox._pack_noexpand_nofill(self.hbox_settings)
        self.main_vbox._pack_noexpand_nofill(self.hbox_buttons)

        self.add(self.main_vbox)

    def _connect_widgets(self):
        self.connect("delete-event", self.close)
        self.btn_legend.connect("clicked", self.show_legend_window)
        self.btn_help.connect("clicked", self._show_help)
        self.btn_close.connect("clicked", self.close)
        self.btn_open_browser.connect("clicked", self.open_browser)
        self.check_color.connect("toggled", self._set_color)
        self.text_mode.connect("clicked", self._change_to_text)
        self.compare_mode.connect("clicked", self._change_to_compare)
        self.scan_chooser1.exp_scan.connect('activate', self.resize_vpane)
        self.scan_chooser2.exp_scan.connect('activate', self.resize_vpane)
        self.scan_buffer1.connect('changed', self.text_changed)
        self.scan_buffer2.connect('changed', self.text_changed)

    def open_browser(self, widget):
        text1=self.scan_buffer1.get_text(self.scan_buffer1.get_start_iter(),\
                                self.scan_buffer1.get_end_iter())
        text2=self.scan_buffer2.get_text(self.scan_buffer2.get_start_iter(),\
                                self.scan_buffer2.get_end_iter())
#.........这里部分代码省略.........
开发者ID:aregee,项目名称:network-scanner,代码行数:103,代码来源:DiffCompare.py

示例12: DiffTree

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]

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

            for p1 in ports1:
                if not p1:
                    continue

                p2 = [port2 for port2 in ports2 \
                        if port2.get("portid", "a") == p1.get("portid", "b")]

                if p2: # Removing found port
                    ports2.remove(p2[0])

                if p1 and p2:
                    self.add_port_diff(parent, "", p1, p2[0])
                elif p1 and not p2:
                    self.add_port_diff(parent, "N", p1, {})

            for p2 in ports2: # If there is something left...
                self.add_port_diff(parent, "A", {}, p2)


    def add_port_diff(self, port_parent, state, port1, port2):
        if (port1 or port2) and isinstance(port1, dict) and\
           isinstance(port2, dict):
            section = port1.get("portid", False)
            if not section: # If port1 is empty, then, try port2
                section = port2.get("portid", "")
            
            parent = self.append_parent(port_parent, section, state)

            self.diff_it(parent, "",
                         _("State"), port1.get("state", ""),
                         port2.get("state", ""))
            
            self.diff_it(parent, "",
                         _("Service Name"), port1.get("name", ""),
                         port2.get("name", ""))
                
            self.diff_it(parent, "",
                         _("Product"), port1.get("product", ""),
                         port2.get("product", ""))
            
            self.diff_it(parent, "",
                         _("Service Version"), port1.get("version", ""),
                         port2.get("version", ""))
            
            self.diff_it(parent, "",
                         _("Protocol"), port1.get("protocol", ""),
                         port2.get("protocol", ""))
                
            self.diff_it(parent, "",
                         _("Extra Info"), port1.get("extrainfo", ""),
                         port2.get("extrainfo", ""))
            
            self.diff_it(parent, "",
                         _("Service Conf"), port1.get("conf", ""),
                         port2.get("conf", ""))

            # Last parent status modification
            if state.upper() == "A":
                self.change_status(parent, "A")

    def add_extraports_diff(self, host_parent, state, extraports1, extraports2):
        if extraports1 or extraports2:
            section =  _("Extraports")
            parent = self.append_parent(host_parent, section, state)
            self.set_parent_status(parent, state)
            
            self.diff_it(parent, "", _("Count"), extraports1.get("count"),
                         extraports2.get("count"))
            self.diff_it(parent, "", _("State"), extraports1.get("state"),
                         extraports2.get("state"))


    def diff_it(self, parent, section, prop_name, prop1, prop2):
        if prop1 or prop2:
            state = diff_state(prop1, prop2)
            self.set_parent_status(parent, state)
            self.diff_tree.append(parent, [state,
                                           section,
                                           prop_name,
                                           prop1,
                                           prop2,
                                           self.colors.get_hex_color(state)])
            return state

    def append_parent(self, parent, section, state):
        self.set_parent_status(parent, state)
        return self.diff_tree.append(parent, [state, section, "", "", "",
                                              self.colors.get_hex_color(state)])

    def search_column(self, widget, column_id):
        self.diff_view.set_search_column(column_id)

    def _pack_widgets(self):
        self._pack_noexpand_nofill(self.diff_title)
        self._pack_expand_fill(self.diff_box)
        self.diff_box._pack_noexpand_nofill(hig_box_space_holder())
        self.diff_box._pack_expand_fill(self.diff_scrolled)

        self.diff_scrolled.add(self.diff_view)
开发者ID:aregee,项目名称:network-scanner,代码行数:104,代码来源:DiffCompare.py

示例13: DiffText

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class DiffText(HIGVBox, object):
    def __init__ (self, colors, check_color):
        HIGVBox.__init__(self)
        self.set_border_width(5)
        self.set_spacing(6)

        self.colors = colors
        self.check_color = check_color
        
        self._create_widgets()
        self._pack_hbox()
        self._set_text_view()
        self._set_scrolled()
        
        self._pack_noexpand_nofill(self.lbl_diff)
        self._pack_expand_fill(self.hbox)
    
    def _create_widgets (self):
        self.hbox = HIGHBox ()
        self.lbl_diff = HIGSectionLabel ("<b>%s</b>" % _("Diff Result"))
        self.scrolled = gtk.ScrolledWindow()
        self.txt_diff_result = gtk.TextView()
        self.txg_tag = gtk.TextTag ("diff_style")
        self.txg_added = gtk.TextTag ('added style')
        self.txg_removed = gtk.TextTag ('removed style')

    def _pack_hbox (self):
        self.hbox.set_border_width(5)
        self.hbox._pack_noexpand_nofill (hig_box_space_holder())
        self.hbox._pack_expand_fill(self.scrolled)

    def _set_scrolled (self):
        self.scrolled.set_size_request(-1, 250)
        
        # Packing text view into scrolled window
        self.scrolled.add_with_viewport(self.txt_diff_result)
        
        # Setting scrolled window
        self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

    def activate_color(self, activate):
        self.check_color = activate
        self._text_changed(None)
    
    def _set_text_view (self):
        self.txg_table = self.txt_diff_result.get_buffer().get_tag_table()
        self.txg_table.add(self.txg_tag)
        self.txg_table.add(self.txg_added)
        self.txg_table.add(self.txg_removed)
        self.txg_tag.set_property("family", "Monospace")
        self.txg_added.set_property("background-gdk", self.colors.added)
        self.txg_removed.set_property("background-gdk", self.colors.not_present)
        
        self.txt_diff_result.set_wrap_mode(gtk.WRAP_WORD)
        self.txt_diff_result.set_editable(False)
        self.txt_diff_result.get_buffer().connect("changed", self._text_changed)
        
    def _text_changed (self, widget):
        self.txg_added.set_property("background-gdk", self.colors.added)
        self.txg_removed.set_property("background-gdk", self.colors.not_present)
        
        buff = self.txt_diff_result.get_buffer()

        buff.apply_tag(self.txg_tag, buff.get_start_iter(), buff.get_end_iter())

        if self.check_color:
            positions = self._take_changes(buff)
            
            for i in positions['added']:
                buff.apply_tag(self.txg_added, i[0],i[1])
            
            for i in positions['removed']:
                buff.apply_tag(self.txg_removed, i[0], i[1])
        else:
            buff.remove_tag(self.txg_added, buff.get_start_iter(),
                            buff.get_end_iter())
            buff.remove_tag(self.txg_removed, buff.get_start_iter(),
                            buff.get_end_iter())

    def _take_changes (self, buffer):
        positions = {'added':[], 'removed':[]}

        in_line = 0
        type = ''

        iter = buffer.get_start_iter ()
        last_char = '\n'

        while iter.forward_char():
            char = iter.get_char ()
            offset = iter.get_offset()
            if not in_line:
                pos = []
                if char == '+' and last_char == '\n':
                    pos.append (buffer.get_iter_at_offset(offset))
                    type = 'added'
                    in_line = 1
                elif char == '-' and last_char == '\n':
                    pos.append (buffer.get_iter_at_offset(offset))
                    type = 'removed'
#.........这里部分代码省略.........
开发者ID:aregee,项目名称:network-scanner,代码行数:103,代码来源:DiffCompare.py

示例14: RegistrationDialog

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]
class RegistrationDialog(HIGDialog):
    """"""

    #----------------------------------------------------------------------
    def __init__(self, title=_('Registration')):
        """Constructor"""
        HIGDialog.__init__(self, title=title,
                           buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                                    gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        
        self._create_widgets()
        self._pack_widgets()

        # Register callbacks
        self.connect("response", self.check_response)

    def _create_widgets(self):
        self.username_label = HIGLabel(_("Username"))
        self.username_entry = gtk.Entry()

        self.password_label = HIGLabel(_("Password"))
        self.password_entry = HIGPasswordEntry()

        self.retype_password_label = HIGLabel(_("Retype password"))
        self.retype_password_entry = HIGPasswordEntry()

        self.registration_icon = gtk.Image()
        self.registration_text = gtk.Label(_("If you don't have an ICM account,"
                "please register a new account."))

        self.hbox = HIGHBox()
        self.table = HIGTable()

    def _pack_widgets(self):
        self.registration_icon.set_from_stock(gtk.STOCK_DIALOG_INFO,
            gtk.ICON_SIZE_DIALOG)
        self.registration_icon.set_padding(10, 0)
        self.registration_text.set_line_wrap(True)

        self.hbox.set_border_width(12)
        self.hbox._pack_noexpand_nofill(self.registration_icon)
        self.hbox._pack_expand_fill(self.registration_text)

        self.vbox.pack_start(self.hbox, False, False)
        self.table.attach_label(self.username_label, 0, 1, 0, 1)
        self.table.attach_entry(self.username_entry, 1, 2, 0, 1)
        self.table.attach_label(self.password_label, 0, 1, 1, 2)
        self.table.attach_entry(self.password_entry, 1, 2, 1, 2)
        self.table.attach_label(self.retype_password_label, 0, 1, 2, 3)
        self.table.attach_entry(self.retype_password_entry, 1, 2, 2, 3)
        self.vbox.pack_start(self.table)

    def check_response(self, widget, response_id):
        if response_id == gtk.RESPONSE_ACCEPT: # clicked on Ok btn
            self.register()
        elif response_id in (gtk.RESPONSE_DELETE_EVENT, gtk.RESPONSE_CANCEL,
                gtk.RESPONSE_NONE):
            self.destroy()

    def register(self):
        username = self.username_entry.get_text()
        password = self.password_entry.get_text()
        theApp.aggregator.register(username, password)
开发者ID:gkso,项目名称:openmonitor-desktop-agent,代码行数:67,代码来源:Registration.py

示例15: OSFingerprintReport

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import _pack_expand_fill [as 别名]

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

        self.btn_ok = gtk.Button(stock=gtk.STOCK_OK)
        self.btn_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)

        self.hbox = HIGHBox()
        self.table = HIGTable()

    def _pack_widgets(self):
        self.notes_scrolled.add(self.notes_text)
        self.notes_scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.notes_scrolled.set_size_request(400, 150)
        self.notes_text.set_wrap_mode(gtk.WRAP_WORD)

        self.fingerprint_icon.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_DIALOG)
        self.fingerprint_icon.set_padding(10, 0)
        self.fingerprint_text.set_line_wrap(True)
        self.fingerprint_text.set_use_markup(True)

        self.table.attach_label(self.submitted_label, 0, 1, 0, 1)
        self.table.attach_entry(self.submitted_entry, 1, 2, 0, 1)

        self.table.attach_label(self.target_device_label, 0, 1, 1, 2)
        self.table.attach_entry(self.target_device_entry, 1, 2, 1, 2)

        self.table.attach_label(self.classification_label, 0, 1, 2, 3)
        self.table.attach_entry(self.classification_combo, 1, 2, 2, 3)

        self.table.attach_label(self.notes_label, 0, 2, 3, 4)
        self.table.attach_entry(self.notes_scrolled, 0, 2, 4, 5)

        self.hbox.set_border_width(12)
        self.hbox._pack_noexpand_nofill(self.fingerprint_icon)
        self.hbox._pack_expand_fill(self.fingerprint_text)

        self.button_box.set_layout(gtk.BUTTONBOX_END)
        self.button_box.pack_start(self.btn_ok)
        self.button_box.pack_start(self.btn_cancel)

        self.vbox.set_border_width(6)
        self.vbox._pack_noexpand_nofill(self.hbox)
        self.vbox._pack_expand_fill(self.table)
        self.vbox._pack_noexpand_nofill(self.button_box)
        self.add(self.vbox)

    def _connect_widgets(self):
        self.btn_ok.connect("clicked", self.send_report)
        self.btn_cancel.connect("clicked", self.close)
        self.connect("delete-event", self.close)

    def close(self, widget=None, event=None):
        self.destroy()

    def send_report(self, widget):
        if self.target_device == "":
            cancel_dialog = HIGAlertDialog(
                type=gtk.MESSAGE_ERROR,
                message_format=_(
                    "Operating System \
Fingerprint report is incomplete!"
                ),
                secondary_text=_(
                    "The Operating \
System Fingerprint report is incomplete. Please, try to provide as much \
information as possible."
                ),
开发者ID:aregee,项目名称:network-scanner,代码行数:70,代码来源:OSFingerprintReport.py


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