本文整理汇总了Python中higwidgets.higtables.HIGTable.attach方法的典型用法代码示例。如果您正苦于以下问题:Python HIGTable.attach方法的具体用法?Python HIGTable.attach怎么用?Python HIGTable.attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类higwidgets.higtables.HIGTable
的用法示例。
在下文中一共展示了HIGTable.attach方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExposeWindow
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class ExposeWindow(TabBox):
"""
Import a Widget with a small preview of Umit (PreviewWindow)
Aim of widget is change structure of Umit like hide menu, etc
"""
def __init__(self, name):
""" Create defaults Widget """
TabBox.__init__(self, name)
def _create_widgets(self):
""" Create widgets"""
# Create table and attach it contains
self.__table = HIGTable(5,2)
binary_mask = gtk.EXPAND|gtk.SHRINK
p = PreviewWindowObj()
p.set_size_request(300,300)
align = gtk.Alignment()
align.add(p)
align.set_padding(10,10,10,10)
self.__table.attach(align, 0,1,0,1,binary_mask, gtk.FILL)
self.pack_start(self.__table, False, False)
def _create_expose_interface(self):
pass
示例2: __init__
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
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()
示例3: LoginDialog
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class LoginDialog(HIGDialog):
""""""
#----------------------------------------------------------------------
def __init__(self, title=_('Open Monitor 2012')):
"""Constructor"""
HIGDialog.__init__(self, title=title, flags=gtk.DIALOG_MODAL,
buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.set_default_response(gtk.RESPONSE_ACCEPT)
self.set_keep_above(True)
self.set_size_request(480, 240)
self.set_border_width(2)
self._create_widgets()
self._pack_widgets()
self._connect_widgets()
def _create_widgets(self):
#Username
self.username_label = HIGLabel(_("Username"))
self.username_entry = HIGTextEntry()
self.username_entry.set_activates_default(True)
#Password
self.password_label = HIGLabel(_("Password"))
self.password_entry = HIGPasswordEntry()
self.password_entry.set_activates_default(True)
#Logo
self.logo_openmonitor = gtk.gdk.pixbuf_new_from_file\
(os.path.join(IMAGES_DIR, 'logoOM.png'))
self.logo_image = gtk.Image()
self.logo_image.set_from_pixbuf(self.logo_openmonitor)
#self.login_text = gtk.Label(_("Log into your ICM agent."))
#Register
#self.register_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,_("Register"))
self.register_label = \
gtk.Label(_("<span foreground='blue'>" \
"Register id</span>"))
self.register_label.set_use_markup(True)
self.register_button = gtk.Button()
self.register_button.add(self.register_label)
self.register_button.set_relief(gtk.RELIEF_NONE)
#Forget Password
self.forgot_password_label = \
gtk.Label(_("<span foreground='blue'>" \
"Forgot password?</span>"))
self.forgot_password_label.set_use_markup(True)
self.forgot_password = gtk.Button()
self.forgot_password.add(self.forgot_password_label)
self.forgot_password.set_relief(gtk.RELIEF_NONE)
#Auto Login
self.auto_login_checkbtn = gtk.CheckButton(_("Auto login"))
#Settings
self.settings_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,_("settings"))
#Container
self.hbox = HIGHBox(False,2)
self.table = HIGTable(8,4,False)
self.table.set_row_spacings(5)
self.table.set_col_spacings(10)
self.action_area.set_homogeneous(False)
#tab orders
self.orders = [self.username_entry, self.password_entry, self.register_button, self.forgot_password]
def _pack_widgets(self):
self.hbox.set_border_width(8)
self.table.set_focus_chain(self.orders)
self.table.attach(self.logo_image,0,7,0,5,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.username_label,0,1,5,6,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.username_entry,1,5,5,6,gtk.FILL|gtk.EXPAND,gtk.FILL|gtk.EXPAND,0,0)
self.table.attach(self.password_label,0,1,6,7,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.password_entry,1,5,6,7,gtk.FILL|gtk.EXPAND,gtk.FILL|gtk.EXPAND,0,0)
self.table.attach(self.register_button,5,6,5,6,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.forgot_password,5,6,6,7,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.auto_login_checkbtn,1,3,7,8,gtk.FILL,gtk.FILL,0,0)
self.hbox._pack_expand_fill(self.table)
self.vbox.pack_start(self.hbox, False, False)
spaceholder1 = hig_box_space_holder()
spaceholder2 = hig_box_space_holder()
spaceholder3 = hig_box_space_holder()
self.action_area.pack_end(spaceholder1)
self.action_area.pack_end(spaceholder2)
self.action_area.pack_end(spaceholder3)
self.action_area.pack_end(self.settings_button)
self.action_area.reorder_child(self.settings_button, 0)
self.action_area.reorder_child(spaceholder1, 1)
#.........这里部分代码省略.........
示例4: PeerInfoPage
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class PeerInfoPage(HIGVBox):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
HIGVBox.__init__(self)
self.__create_widgets()
self.__pack_widgets()
def __create_widgets(self):
""""""
self.peerinfo_hbox = HIGHBox()
self.cloudagg_hbox = HIGHBox()
self.superpeers_hbox = HIGHBox()
self.pref_location_hbox = HIGHBox()
self.peerinfo_section = HIGSectionLabel(_("Peer Info"))
self.peerinfo_table = HIGTable()
self.pref_location_section = HIGSectionLabel(_("Preferred Locations"))
self.pref_location_table = HIGTable()
self.cloudagg_section = HIGSectionLabel(_("Cloud Aggregator"))
self.cloudagg_table = HIGTable()
self.cloudagg_subhbox = HIGHBox()
self.superpeers_section = HIGSectionLabel(_("Super Peers"))
self.superpeers_table = HIGTable()
self.peerid_label = HIGEntryLabel(_("Peer ID:"))
self.email_label = HIGEntryLabel(_("Email Address:"))
self.test_version_label = HIGEntryLabel(_("Test Sets Version:"))
self.peerid_label2 = HIGEntryLabel()
self.email_entry = gtk.Entry()
self.test_version_label2 = HIGEntryLabel()
self.longitude_label = HIGLabel(_("longitude:"))
self.longitude_entry = gtk.Entry()
self.latitude_label = HIGLabel(_("latitude:"))
self.latitude_entry = gtk.Entry()
self.cloudagg_entry = gtk.Entry()
self.cloudagg_button = HIGButton(_("Reset"))
self.cloudagg_button.connect('clicked', lambda w: self.reset_aggregator_url())
self.cloudagg_button.set_size_request(80, 28)
self.superpeers_ip_label = HIGLabel(_("IP:"))
self.superpeers_ip_entry = gtk.Entry()
self.superpeers_ip_entry.set_size_request(160, 26)
self.superpeers_port_label = HIGLabel(_("Port:"))
self.superpeers_port_entry = gtk.Entry()
self.superpeers_port_entry.set_size_request(80, 26)
self.superpeers_subhbox = HIGHBox()
self.btn_box = gtk.HButtonBox()
self.superpeers_button1 = HIGButton(_("Add"))
self.superpeers_button1.connect('clicked',lambda w:self.add_superpeer())
self.superpeers_button2 = HIGButton(_("Show all"))
self.superpeers_button2.connect('clicked', lambda w:
self.show_super_peer_list_window())
def __pack_widgets(self):
self.set_border_width(12)
self._pack_noexpand_nofill(self.peerinfo_section)
self._pack_noexpand_nofill(self.peerinfo_hbox)
self._pack_noexpand_nofill(self.pref_location_section)
self._pack_noexpand_nofill(self.pref_location_hbox)
self._pack_noexpand_nofill(self.cloudagg_section)
self._pack_noexpand_nofill(self.cloudagg_hbox)
self._pack_noexpand_nofill(self.superpeers_section)
self._pack_noexpand_nofill(self.superpeers_hbox)
self.peerinfo_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.peerinfo_hbox._pack_expand_fill(self.peerinfo_table)
self.pref_location_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.pref_location_hbox._pack_expand_fill(self.pref_location_table)
self.cloudagg_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.cloudagg_hbox._pack_expand_fill(self.cloudagg_table)
self.superpeers_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.superpeers_hbox._pack_expand_fill(self.superpeers_table)
self.peerinfo_table.attach_label(self.peerid_label, 0, 1, 0, 1)
self.peerinfo_table.attach_label(self.email_label, 0, 1, 2, 3)
self.peerinfo_table.attach_label(self.test_version_label, 0, 1, 1, 2)
self.peerinfo_table.attach_label(self.test_version_label2, 1, 2, 1, 2)
self.peerinfo_table.attach_label(self.peerid_label2, 1, 2, 0, 1)
self.peerinfo_table.attach_entry(self.email_entry, 1, 2, 2, 3)
self.pref_location_table.attach(self.longitude_label,0,1,0,1)
self.pref_location_table.attach(self.longitude_entry,1,2,0,1)
self.pref_location_table.attach(self.latitude_label,2,3,0,1)
self.pref_location_table.attach(self.latitude_entry,3,4,0,1)
self.cloudagg_subhbox._pack_expand_fill(self.cloudagg_entry)
self.cloudagg_subhbox._pack_noexpand_nofill(self.cloudagg_button)
#.........这里部分代码省略.........
示例5: __do_layout
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
def __do_layout(self):
"""
Layout window widgets.
"""
main_vbox = HIGVBox()
main_vbox.set_border_width(5)
main_vbox.set_spacing(12)
header_hbox = HIGHBox()
schedp_hbox = HIGHBox()
cron_box = HIGVBox()
cron_table = HIGTable(5, 2)
btns_hbox = HIGHBox()
header_hbox._pack_expand_fill(self.ttitle)
header_hbox._pack_noexpand_nofill(self.umit_logo)
schedp_hbox._pack_noexpand_nofill(self.schedp_name_lbl)
schedp_hbox._pack_expand_fill(self.schedp_name)
# cron format
settings_align = gtk.Alignment(0.5, 0.5, 1, 1)
settings_align.set_padding(6, 0, 12, 0)
cron_table.attach(self.cron_minute_lbl, 0, 1, 0, 1)
cron_table.attach(self.cron_minute, 1, 2, 0, 1)
cron_table.attach(self.cron_hour_lbl, 0, 1, 1, 2)
cron_table.attach(self.cron_hour, 1, 2, 1, 2)
cron_table.attach(self.cron_day_lbl, 0, 1, 2, 3)
cron_table.attach(self.cron_day, 1, 2, 2, 3)
cron_table.attach(self.cron_month_lbl, 0, 1, 3, 4)
cron_table.attach(self.cron_month, 1, 2, 3, 4)
cron_table.attach(self.cron_weekday_lbl, 0, 1, 4, 5)
cron_table.attach(self.cron_weekday, 1, 2, 4, 5)
cron_box._pack_noexpand_nofill(cron_table)
settings_align.add(cron_box)
self.cron_frame.add(settings_align)
# bottom buttons
btns_hbox.set_homogeneous(True)
btns_hbox._pack_expand_fill(self.help)
btns_hbox._pack_expand_fill(hig_box_space_holder())
btns_hbox._pack_expand_fill(self.apply)
btns_hbox._pack_expand_fill(self.cancel)
btns_hbox._pack_expand_fill(self.ok)
main_vbox._pack_noexpand_nofill(header_hbox)
main_vbox._pack_noexpand_nofill(gtk.HSeparator())
main_vbox._pack_noexpand_nofill(schedp_hbox)
main_vbox._pack_noexpand_nofill(self.cron_frame)
main_vbox.pack_end(btns_hbox, False, False, 0)
self.add(main_vbox)
示例6: NmapOutputProperties
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class NmapOutputProperties(HIGDialog):
def __init__(self, nmap_output_view):
HIGDialog.__init__(self, _("Nmap Output Properties"),
buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
self.nmap_highlight = NmapOutputHighlight()
self.__create_widgets()
self.__pack_widgets()
self.highlight_tab()
self.vbox.show_all()
def __create_widgets(self):
self.properties_notebook = HIGNotebook()
def __pack_widgets(self):
self.vbox.pack_start(self.properties_notebook)
def highlight_tab(self):
# Creating highlight tab main box
self.highlight_main_vbox = HIGVBox()
# Creating highlight tab main table
self.highlight_main_table = HIGTable()
self.highlight_main_table.set_border_width(6)
#############
# Properties:
self.property_names = {"details": [_("details"), "MAC Address:"],
"port_list": [_("port listing title"),
"PORT STATE SERVICE"],
"open_port": [_("open port"),
"22/tcp open ssh"],
"closed_port": [_("closed port"),
"70/tcp closed gopher"],
"filtered_port": [_("filtered port"),
"80/tcp filtered http"],
"date": [_("date"),
"2006-05-26 11:14 BRT"],
"hostname": [_("hostname"),
"scanme.nmap.org"],
"ip": [_("ip"),
"127.0.0.1"]}
for p in self.property_names:
settings = self.nmap_highlight.__getattribute__(p)
self.property_names[p].append(settings[0])
self.property_names[p].append(settings[1])
self.property_names[p].append(settings[2])
self.property_names[p].append(gtk.gdk.Color(*settings[3]))
self.property_names[p].append(gtk.gdk.Color(*settings[4]))
self.property_names[p].append(settings[5])
# Creating properties and related widgets and attaching it to main table
y1 = 0
y2 = 1
for p in self.property_names:
hp = HighlightProperty(p, self.property_names[p])
self.highlight_main_table.attach(hp.property_name_label,
0, 1, y1, y2)
self.highlight_main_table.attach(hp.example_label,
1, 2, y1, y2)
self.highlight_main_table.attach(hp.bold_tg_button,
2, 3, y1, y2)
self.highlight_main_table.attach(hp.italic_tg_button,
3, 4, y1, y2)
self.highlight_main_table.attach(hp.underline_tg_button,
4, 5, y1, y2)
self.highlight_main_table.attach(hp.text_color_button,
5, 6, y1, y2)
self.highlight_main_table.attach(hp.highlight_color_button,
6, 7, y1, y2)
# Setting example styles and colors
hp.update_example()
self.property_names[p].append(hp)
y1 += 1
y2 += 1
# Packing main table into main vbox
self.highlight_main_vbox.pack_start(self.highlight_main_table)
# Adding color tab
self.properties_notebook.append_page(self.highlight_main_vbox,
gtk.Label(_("Highlight definitions")))
示例7: set_scan_infos
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
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)
示例8: FeedbackPage
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class FeedbackPage(HIGVBox):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
HIGVBox.__init__(self)
self.__create_widgets()
self.__pack_widgets()
self.__set_values()
def __create_widgets(self):
self.suggestion_hbox = HIGHBox()
self.report_hbox = HIGHBox()
self.suggestion_section = HIGSectionLabel(_("Test Suggestion"))
self.suggestion_table = HIGTable()
self.report_section = HIGSectionLabel(_("Bug Report"))
self.report_table = HIGTable()
# Website Suggestion
self.website_suggestion_table = HIGTable()
self.website_suggestion_slabel = HIGSectionLabel(_("Website Suggestion"))
self.website_url_subhbox = HIGHBox()
self.website_url_label = HIGEntryLabel(_("URL:"))
self.website_url_entry = gtk.Entry()
self.website_suggestion_sendbtn = HIGButton(_('Send'))
self.website_suggestion_sendbtn.set_size_request(60, 25)
self.website_suggestion_sendbtn.connect(
'clicked', lambda x: self.send_website_suggestion())
# Service Suggestion
self.service_suggestion_table = HIGTable()
self.service_suggestion_slabel = HIGSectionLabel(_("Service Suggestion"))
self.service_name_subhbox = HIGHBox()
self.service_name_label = HIGEntryLabel(_("Name:"))
self.service_list_store = gtk.ListStore(str)
self.service_name_entry = gtk.ComboBoxEntry(self.service_list_store, 0)
self.service_host_subhbox = HIGHBox()
self.service_host_label = HIGEntryLabel(_("Hostname:"))
self.service_host_entry = gtk.Entry()
self.service_ip_subhbox = HIGHBox()
self.service_ip_label = HIGEntryLabel(_("IP:"))
self.service_ip_entry = gtk.Entry()
self.service_port_label = HIGEntryLabel(_("PORT:"))
self.service_port_entry = gtk.Entry()
self.service_suggestion_sendbtn = HIGButton(_('Send'))
self.service_suggestion_sendbtn.set_size_request(60, 25)
self.service_suggestion_sendbtn.connect(
'clicked', lambda x: self.send_service_suggestion())
self.report_namelabel = HIGEntryLabel(_("Your Name:"))
self.report_nameentry = gtk.Entry()
#self.report_nameentry.set_has_frame(True)
self.report_nameentry.set_size_request(100, 26)
self.report_emaillabel = HIGEntryLabel(_("Email:"))
self.report_emailentry = gtk.Entry()
self.report_emailentry.set_size_request(198, 26)
self.report_subhbox1 = HIGHBox()
self.report_sw = gtk.ScrolledWindow()
self.report_sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.report_textview = gtk.TextView()
self.report_textbuffer = self.report_textview.get_buffer()
self.report_textview.set_editable(True)
self.report_textview.set_wrap_mode(True)
self.report_textview.set_border_width(2)
self.report_sw.add(self.report_textview)
self.report_sw.show()
self.report_textview.show()
self.report_subhbox2 = HIGHBox()
self.report_sendbtn = HIGButton(_('Send'))
self.report_sendbtn.set_size_request(60, 25)
self.report_sendbtn.connect('clicked', lambda x: self.send_bug_report())
self.report_subhbox3 = HIGHBox()
def __pack_widgets(self):
self.set_border_width(12)
self._pack_noexpand_nofill(self.suggestion_section)
self._pack_noexpand_nofill(self.suggestion_hbox)
self._pack_noexpand_nofill(self.report_section)
self._pack_noexpand_nofill(self.report_hbox)
#self.suggestion_hbox._pack_noexpand_nofill(hig_box_space_holder())
#self.suggestion_hbox._pack_expand_fill(self.suggestion_table)
#self.report_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.report_hbox._pack_expand_fill(self.report_table)
self.suggestion_hbox._pack_expand_fill(self.suggestion_table)
#self.suggestion_hbox._pack_expand_fill(self.service_suggestion_table)
self.suggestion_table.attach_label(self.website_suggestion_slabel,
0, 2, 0, 1)
self.suggestion_table.attach_label(self.website_url_label,
0, 1, 1, 2)
self.suggestion_table.attach_entry(self.website_url_entry,
1, 2, 1, 2)
self.suggestion_table.attach(self.website_suggestion_sendbtn,
0, 2, 2, 3, gtk.PACK_START)
#.........这里部分代码省略.........
示例9: ScanChooser
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class ScanChooser(HIGVBox):
def __init__(self, scan_dict, num=""):
HIGVBox.__init__(self)
self.num = num
self.scan_dict = scan_dict
# Setting HIGVBox
self.set_border_width(5)
self.set_spacing(6)
self._create_widgets()
self._pack_hbox()
self._attaching_widgets()
self._set_scrolled()
self._set_text_view()
self._set_open_button()
for scan in scan_dict:
self.list_scan.append([scan])
self.combo_scan.connect('changed', self.show_scan)
self._pack_noexpand_nofill(self.lbl_scan)
self._pack_expand_fill(self.hbox)
def _create_widgets(self):
self.lbl_scan = HIGSectionLabel("%s %s"%(_("Scan Result"),
str(self.num)))
self.hbox = HIGHBox()
self.table = HIGTable()
self.list_scan = gtk.ListStore(str)
self.combo_scan = gtk.ComboBoxEntry(self.list_scan, 0)
self.btn_open_scan = gtk.Button(stock=gtk.STOCK_OPEN)
self.exp_scan = gtk.Expander(_("Scan Result Visualization"))
self.scrolled = gtk.ScrolledWindow()
self.txt_scan_result = gtk.TextView()
self.txg_tag = gtk.TextTag("scan_style")
def get_buffer(self):
return self.txt_scan_result.get_buffer()
def show_scan (self, widget):
try:
self.txt_scan_result.get_buffer().\
set_text(self.normalize_output(\
self.scan_dict[widget.child.get_text()].nmap_output))
except KeyError:
# Avoid to raise an error if the user writes within
# the entry and the scan doesn't exits
pass
def normalize_output(self, output):
return "\n".join(output.split("\\n"))
def _pack_hbox (self):
self.hbox._pack_noexpand_nofill(hig_box_space_holder())
self.hbox._pack_expand_fill(self.table)
def _attaching_widgets (self):
self.table.attach(self.combo_scan, 0,1,0,1, yoptions=0)
self.table.attach(self.btn_open_scan, 1,2,0,1, yoptions=0, xoptions=0)
self.table.attach(self.exp_scan, 0,2,1,2)
def _set_scrolled(self):
self.scrolled.set_border_width(5)
self.scrolled.set_size_request(-1, 160)
# Packing scrolled window into expander
self.exp_scan.add(self.scrolled)
# Packing text view into scrolled window
self.scrolled.add_with_viewport(self.txt_scan_result)
# Setting scrolled window
self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
def _set_text_view (self):
self.txg_table = self.txt_scan_result.get_buffer().get_tag_table()
self.txg_table.add(self.txg_tag)
self.txg_tag.set_property("family", "Monospace")
self.txt_scan_result.set_wrap_mode(gtk.WRAP_WORD)
self.txt_scan_result.set_editable(False)
self.txt_scan_result.get_buffer().connect("changed",
self._text_changed_cb)
def _set_open_button (self):
self.btn_open_scan.connect('clicked', self.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()
#.........这里部分代码省略.........
示例10: GeneralSettings
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class GeneralSettings(TabBox, object):
"""
General Settings
- Splash enable/disable
- Warnings
- Erros, log, configure bugreport
- Autosave: clean up, define folder etc
- Define Nmap Command
"""
def __init__(self, name):
TabBox.__init__(self, name)
def _create_widgets(self):
"""
Design all
"""
# Create general widgets
self._create_widgets_common()
self._create_widgets_autosave()
self._create_widgets_error()
# Packing main section
self.pack_start(self._box_common, False, False)
self.pack_start(self._box_error_frame, False, False)
self.pack_start(self._box_save_frame, False, False)
self._box_error_frame.set_shadow_type(gtk.SHADOW_NONE)
self._box_error_frame.set_shadow_type(gtk.SHADOW_NONE)
# Settings Values
self.splash = general_settings.splash
self.warnings_extensions = general_settings.warnings_extensions
self.silent_root = general_settings.silent_root
self.crash_report = general_settings.crash_report
self.log = general_settings.log
self.log_file = general_settings.log_file
self.warnings_save = general_settings.warnings_save
self._connect_events()
def _create_widgets_common(self):
""" generally tab """
self._box_common = HIGVBox() # pack main section
self.__check_splash = gtk.CheckButton(_('Enable Splash on start'))
self.__check_silent_root = gtk.CheckButton(\
_('Silent Warning Non-Root'))
self.__check_warning_extensions = gtk.CheckButton(\
_('Set/Check extensions - Windows only'))
self._box_common.pack_start(self.__check_splash, False, False)
#self._box_common.pack_start(self.__check_warning_extensions, False, \
# False)
self._box_common.pack_start(self.__check_silent_root, False, False)
self.__label_nmap = HIGEntryLabel(_('Nmap Command'))
self.__entry_nmap = HIGTextEntry()
# Files usr saved on predefined directory:
self.__label_path = HIGEntryLabel(_('Nmap Command'))
self.__entry_path = HIGTextEntry()
self.__button_path = HIGButton(_('Choose'))
self.__box_path = HIGHBox()
self.__box_path.pack_start(self.__label_path, False, False)
self.__box_path.pack_end(self.__button_path, False, False)
self._box_common.set_border_width(0)
def _create_widgets_error(self):
# Create Widgets
self._box_error_frame = HIGFrame('Error')
self._box_error = HIGTable(5, 2)
self._box_error.set_border_width(10)
self._box_error_frame.add(self._box_error)
self.__crash_report = gtk.CheckButton(_('Enable Crash Report'))
# Radio Button List
self.__log_no = gtk.RadioButton(None, _('No log'))
self.__log_terminal = gtk.RadioButton(self.__log_no, _('Enable log in terminal'))
self.__log_file = gtk.RadioButton(self.__log_terminal,\
_('Enable log file'))
self.__log_file_label = HIGEntryLabel(_('Log file'))
self.__log_file_entry = HIGTextEntry()
self.__log_file_entry.set_editable(False)
# FIXME: Do default file ~/.umit/umit.log
self.__log_file_browser = HIGButton(_('Browse file'), \
gtk.STOCK_DIRECTORY)
tmpbox = HIGHBox()
tmpbox.pack_start(self.__log_file_entry, False, False)
tmpbox.pack_start(self.__log_file_browser, False, False)
# attach table
self._box_error.attach(self.__crash_report, 0,1,0,1,\
gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
self._box_error.attach(self.__log_no, 0,1,1,2,\
gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
#.........这里部分代码省略.........
示例11: NetworkTab
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class NetworkTab(TabBox, object):
def __init__(self, name):
"""
Create widgets of Proxy
"""
TabBox.__init__(self, name)
self._connect_events()
#Propertys:
self.proxy = network_conf.proxy
self.hostname = network_conf.hostname
self.port = network_conf.port
self.username = network_conf.username
self.password = network_conf.password
def _create_widgets(self):
self._create_widgets_proxy()
self.pack_start(self.__frame, False, False)
def _create_widgets_proxy(self):
self.__frame = TabFrame(_("Proxy Settings"))
self.__frame.set_shadow_type(gtk.SHADOW_NONE)
self.__frame_box = HIGTable(6,2, True)
self._radio_no_proxy = gtk.RadioButton(None, _('No proxy server'))
self._radio_proxy = gtk.RadioButton(self._radio_no_proxy,
_('Configure server'))
# Core Structure of data of proxy:
fields = []
fields.append({'name':'hostname',
'label':_('Hostname'),
'values': network_conf.hostname,
'entry' : None
})
fields.append({'name':'port',
'label':_('Port'),
'values': network_conf.port,
'entry' : None ,
'type' : 'spin'
})
fields.append({'name':'username',
'label':_('Username'),
'values': network_conf.username,
'entry' : None
})
fields.append({'name': 'password',
'label':_('Password'),
'values': network_conf.password,
'entry' : None,
'type' : 'password'
})
self.__proxy_fields = fields
# Create, attach and set values of widgets of proxy
xopt = gtk.FILL|gtk.EXPAND| gtk.SHRINK
yopt = gtk.FILL
self.__frame_box.attach(self._radio_no_proxy, 0,1,0,1, xopt, yopt)
self.__frame_box.attach(self._radio_proxy,0,1,1,2)
row = 2
# Create list of labels/entrys
self.__label_list = []
self.__entry_list = []
for field in fields:
# Create widgets
label = gtk.Label(field['label'])
if field.has_key('type') and field['type'] == 'spin':
entry = IntSpin()
else:
entry = HIGTextEntry()
# Add widgets to lists
self.__label_list.append(label)
self.__entry_list.append(entry)
field['entry'] = entry
# Customize
label.set_alignment(1.0, 0.0)
# Attachment Table
self.__frame_box.attach(label, 0,1,row,row+1, \
xopt, yopt)
self.__frame_box.attach(entry,1,2,row,row+1)
#.........这里部分代码省略.........
示例12: ScanRunDetailsPage
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class ScanRunDetailsPage(HIGVBox):
def __init__(self):
HIGVBox.__init__(self)
self.__create_widgets()
def __create_widgets(self):
na = _('Not available')
self.command_expander = gtk.Expander("<b>"+_("Command Info")+"</b>")
self.general_expander = gtk.Expander("<b>"+_("General Info")+"</b>")
# Command info
self.command_label = HIGEntryLabel(_('Command:'))
self.info_command_label = HIGEntryLabel(na)
self.nmap_version_label = HIGEntryLabel(_('Nmap Version:'))
self.info_nmap_version_label = HIGEntryLabel(na)
self.verbose_label = HIGEntryLabel(_('Verbosity level:'))
self.info_verbose_label = HIGEntryLabel(na)
self.debug_label = HIGEntryLabel(_('Debug level:'))
self.info_debug_label = HIGEntryLabel(na)
self.command_table = HIGTable()
self.command_hbox = HIGHBox()
# General info:
self.start_label = HIGEntryLabel(_('Started on:'))
self.info_start_label = HIGEntryLabel(na)
self.finished_label = HIGEntryLabel(_('Finished on:'))
self.info_finished_label = HIGEntryLabel(na)
self.host_up_label = HIGEntryLabel(_('Hosts up:'))
self.info_hosts_up_label = HIGEntryLabel(na)
self.host_down_label = HIGEntryLabel(_('Hosts down:'))
self.info_hosts_down_label = HIGEntryLabel(na)
self.host_scanned_label = HIGEntryLabel(_('Hosts scanned:'))
self.info_hosts_scanned_label = HIGEntryLabel(na)
self.open_label = HIGEntryLabel(_('Open ports:'))
self.info_open_label = HIGEntryLabel(na)
self.filtered_label = HIGEntryLabel(_('Filtered ports:'))
self.info_filtered_label = HIGEntryLabel(na)
self.closed_label = HIGEntryLabel(_('Closed ports:'))
self.info_closed_label = HIGEntryLabel(na)
self.general_table = HIGTable()
self.general_hbox = HIGHBox()
def set_command_info(self, info):
# Fix aligment!
self.command_expander.set_use_markup(True)
self.command_table.set_border_width(5)
self.command_table.set_row_spacings(6)
self.command_table.set_col_spacings(6)
try:self.info_command_label.set_text(info['command'])
except:pass
try:self.info_nmap_version_label.set_text(info['version'])
except:pass
try:self.info_verbose_label.set_text(info['verbose'])
except:pass
try:self.info_debug_label.set_text(info['debug'])
except:pass
self.command_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.command_hbox._pack_noexpand_nofill(self.command_table)
self.command_table.attach(self.command_label,0,1,0,1)
self.command_table.attach(self.info_command_label,1,2,0,1)
self.command_table.attach(self.nmap_version_label,0,1,1,2)
self.command_table.attach(self.info_nmap_version_label,1,2,1,2)
self.command_table.attach(self.verbose_label,0,1,2,3)
self.command_table.attach(self.info_verbose_label,1,2,2,3)
self.command_table.attach(self.debug_label,0,1,3,4)
self.command_table.attach(self.info_debug_label,1,2,3,4)
self.command_expander.add(self.command_hbox)
self._pack_noexpand_nofill(self.command_expander)
self.command_expander.set_expanded(True)
def set_general_info(self, info):
# Fix aligment!
self.general_expander.set_use_markup(True)
self.general_table.set_border_width(5)
self.general_table.set_row_spacings(6)
self.general_table.set_col_spacings(6)
#.........这里部分代码省略.........
示例13: UpdatePage
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class UpdatePage(HIGVBox):
""""""
def __init__(self):
"""Constructor"""
HIGVBox.__init__(self)
self.__create_widgets()
self.__pack_widgets()
self.__load_list()
self.__connect_widgets()
self.__init_db_text()
def __create_widgets(self):
""""""
self.update_switch_hbox = HIGHBox()
self.update_settings_hbox = HIGHBox()
self.update_db_hbox = HIGHBox()
self.update_switch_section = HIGSectionLabel(_("Update News Detect"))
self.update_switch_table = HIGTable()
self.update_settings_section = HIGSectionLabel(_("Update Settings"))
self.update_settings_table = HIGTable()
self.update_db_section = HIGSectionLabel(_("Update Database"))
self.update_db_table = HIGTable()
self.update_check = gtk.CheckButton(_("Automatically update"))
self.update_switch_check = gtk.CheckButton(_("Software Update Detect Switch"))
self.update_times_label = HIGEntryLabel(_("Auto detect update news"))
self.update_method_label = HIGEntryLabel(_("Update method"))
self.update_time_store = gtk.ListStore(str)
self.update_time_entry = gtk.ComboBoxEntry(self.update_time_store, 0)
self.update_method_store = gtk.ListStore(str)
self.update_method_entry = gtk.ComboBoxEntry(self.update_method_store, 0)
self.update_db_label = HIGEntryLabel()
self.update_db_clear_button = gtk.Button(_("Clear Update Information"))
def __pack_widgets(self):
""""""
self.set_border_width(12)
self._pack_noexpand_nofill(self.update_switch_section)
self._pack_noexpand_nofill(self.update_switch_hbox)
self._pack_noexpand_nofill(hig_box_space_holder())
self._pack_noexpand_nofill(self.update_settings_section)
self._pack_noexpand_nofill(self.update_settings_hbox)
self._pack_noexpand_nofill(self.update_db_section)
self._pack_noexpand_nofill(self.update_db_hbox)
self.update_switch_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.update_switch_hbox._pack_expand_fill(self.update_switch_table)
self.update_settings_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.update_settings_hbox._pack_expand_fill(self.update_settings_table)
self.update_db_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.update_db_hbox._pack_expand_fill(self.update_db_table)
self.update_switch_table.attach_label(self.update_check, 0, 2, 0, 1)
self.update_switch_table.attach_label(self.update_switch_check, 0, 2, 1, 2)
self.update_settings_table.attach_label(self.update_times_label, 0, 1, 0, 1)
self.update_settings_table.attach_entry(self.update_time_entry, 1, 2, 0, 1)
self.update_settings_table.attach_label(self.update_method_label, 0, 1, 1, 2)
self.update_settings_table.attach_entry(self.update_method_entry, 1, 2, 1, 2)
self.update_db_table.attach_label(self.update_db_label, 1, 3, 0, 1)
self.update_db_table.attach(self.update_db_clear_button, 0, 1, 0, 1)
def __init_db_text(self):
""""""
rs = g_db_helper.select("select * from updates")
count = len(rs)
self.update_db_label.set_text(str(_("%d records in update database now."%(count))))
def __connect_widgets(self):
""""""
self.update_check.connect('toggled',lambda w:self.__change_widgets_status())
self.update_db_clear_button.connect("clicked", lambda w:self.__clear_update_db())
def __clear_update_db(self):
""""""
g_db_helper.execute("delete from updates")
g_db_helper.commit()
self.update_db_label.set_text(str(_("Clear software update database!")))
def __change_widgets_status(self):
""""""
if self.update_check.get_active():
self.__disable_widgets()
else:
self.__enable_widgets()
def __load_list(self):
""""""
for s in update_time_str.keys():
#print s
self.update_time_store.append([s])
for s in update_method_str.keys():
#print s
#.........这里部分代码省略.........
示例14: __pack_widgets
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
def __pack_widgets(self):
self.add(self.main_vbox)
# Packing widgets to main_vbox
self.main_vbox._pack_noexpand_nofill(self.command_expander)
self.main_vbox._pack_expand_fill(self.notebook)
self.main_vbox._pack_noexpand_nofill(self.buttons_hbox)
# Packing command_entry on command_expander
self.command_expander.hbox.pack_start(self.command_entry)
# Packing profile information tab on notebook
self.notebook.append_page(self.profile_info_vbox, gtk.Label(_('Profile')))
self.profile_info_vbox.set_border_width(5)
table = HIGTable()
self.profile_info_vbox._pack_noexpand_nofill(self.profile_info_label)
self.profile_info_vbox._pack_noexpand_nofill(HIGSpacer(table))
self.profile_annotation_scroll.add(self.profile_annotation_text)
self.profile_description_scroll.add(self.profile_description_text)
vbox_desc = HIGVBox()
vbox_desc._pack_noexpand_nofill(self.profile_description_label)
vbox_desc._pack_expand_fill(hig_box_space_holder())
vbox_ann = HIGVBox()
vbox_ann._pack_noexpand_nofill(self.profile_annotation_label)
vbox_ann._pack_expand_fill(hig_box_space_holder())
table.attach(self.profile_name_label,0,1,0,1)
table.attach(self.profile_name_entry,1,2,0,1)
#table.attach(self.profile_hint_label,0,1,1,2,xoptions=0)
table.attach(self.profile_hint_label,0,1,1,2)
table.attach(self.profile_hint_entry,1,2,1,2)
table.attach(vbox_desc,0,1,2,3)
table.attach(self.profile_description_scroll,1,2,2,3)
table.attach(vbox_ann,0,1,3,4)
table.attach(self.profile_annotation_scroll,1,2,3,4)
# Packing buttons on button_hbox
self.buttons_hbox.pack_start(self.help_button)
#self.buttons_hbox.pack_start(self.delete_button)
self.buttons_hbox.pack_start(self.cancel_button)
self.buttons_hbox.pack_start(self.ok_button)
self.buttons_hbox.set_border_width(5)
self.buttons_hbox.set_spacing(6)
示例15: Proprieties
# 需要导入模块: from higwidgets.higtables import HIGTable [as 别名]
# 或者: from higwidgets.higtables.HIGTable import attach [as 别名]
class Proprieties(HIGScrolledWindow):
'''
This box should be configurable
if widget is of a type all configuration should be change to this type
#tricks: option_list have a icon to fill with options
and option_check have a list of options in combo to change
'''
def __init__(self):
HIGScrolledWindow.__init__(self)
self._boxeditable = None
vp = gtk.Viewport()
self._create_widgets()
vp.add(self._box)
vp.set_shadow_type(gtk.SHADOW_NONE)
self.add(vp)
self._profilecore = None
self._selected = None
def set_profilecore(self, profilecore):
self._profilecore = profilecore
def _create_widgets(self):
'''
Create the main entrys of the option
'''
self._box = HIGVBox()
self._table = HIGTable()
#Name
self._label_name = HIGEntryLabel(_('Name'))
self._entry_name = HIGTextEntry()
self._entry_name.connect('activate', self._update_label)
#Type
self._label_type = HIGEntryLabel(_('Type'))
self._combo_type = gtk.combo_box_new_text()
self._combo_type.append_text('')
self._combo_type.append_text('Option List')
self._combo_type.append_text('Option Check')
self._combo_type.set_active(0)
self._combo_type.connect('changed', self.change_combo)
self._label_opt = HIGEntryLabel(_('Option'))
self._entry_opt = HIGTextEntry()
self._entry_opt.set_sensitive(False)
#For option list open a dialog to add/remove options
self._button_list = HIGButton('Edit Option List')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'combo.png')
img.set_from_file(img_dir)
self._button_list.set_image(img)
self._button_list.connect('button-press-event', self._button_list_clicked)
self._table.attach(self._label_name, 0,1,0, 1)
self._table.attach(self._entry_name, 1,2,0,1)
self._table.attach(self._label_type, 0,1,1,2)
self._table.attach(self._combo_type, 1,2,1, 2)
self._table.attach(self._button_list, 0,2, 3,4)
self._table.attach(self._label_opt, 0,1, 4,5)
self._table.attach(self._entry_opt, 1,2,4,5)
self._box.pack_start(self._table, False, False)
def _button_list_clicked(self, widget, event):
section_name = self._boxeditable.get_name()
lm = ListManager(self._entry_name.get_text(),section_name,
self._profilecore, self._selected, _('List of items'))
def _update_label(self, widget):
#XXX Replace by Command
log.debug("Update Label")
selected = self._selected
cmd = CommandChangeLabel(selected, self._entry_name.get_text(),
self._profilecore,self._boxeditable, True)
command_manager.add_command(cmd)
def change_combo(self,combo):
model = combo.get_model()
index = combo.get_active()
if index:
if model[index][0]=='Option List':
log.debug('Show Button List ')
self._button_list.show()
else:
log.debug('Hide Button List ')
self._button_list.hide()
return
#.........这里部分代码省略.........