def __init__(self, logic, width, height): self.logic = logic super(StandardView, self).__init__(width, height) self.set_homogeneous(False) hbox = gtk.HBox(False) hbox.pack_start(gtk.Label("Mode: ")) tf = gtk.Entry() entryBuff = gtk.EntryBuffer(logic.mode, -1) tf.set_buffer(entryBuff) tf.set_editable(False) #tf.connect("changed", self.tf_changed) self.logic.add_mode_status_output(tf) hbox.pack_start(tf) self.pack_start(hbox) # Text View hbox = gtk.HBox(False) hbox.pack_start(gtk.Label("Heard:")) self.scrolled_window = gtk.ScrolledWindow() self.scrolled_window.set_border_width(10) self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) textbuf = gtk.TextBuffer() self.logic.add_output_on_gui(textbuf) text = gtk.TextView(textbuf) text.set_wrap_mode(gtk.WRAP_WORD) text.set_editable(False) text.set_cursor_visible(False) # Auto scroll ScrolledWindow text.connect('size-allocate', self.text_changed) self.scrolled_window.add(text) self.scrolled_window.get_vadjustment().set_upper( text.get_vadjustment().get_upper()) hbox.pack_start(self.scrolled_window) self.pack_start(hbox) # Buttons box hbox = gtk.HBox() self.lis_button = gtk.ToggleButton("Start Listening") self.lis_button.connect('clicked', self.buttListen_clicked) hbox.pack_start(self.lis_button) button = gtk.Button("Update") button.connect('clicked', self.buttUpdate_clicked) hbox.pack_start(button) button = gtk.Button("Quit") button.connect('clicked', self.buttQuit_clicked) hbox.pack_start(button) self.pack_start(hbox)
def __init__(self, data): self.data = data super(ActionEntry, self).__init__() vbox = gtk.VBox() hbox = gtk.HBox() button = None for action_type in Data.action_types_ordered.keys(): button = gtk.RadioButton(button, action_type) if Data.action_types[action_type] == self.data[0]: button.set_active(True) button.connect("toggled", self.action_type_changed, action_type) hbox.pack_start(button, True, True, 0) tf = gtk.Entry() entryBuff = gtk.EntryBuffer(self.data[1], -1) tf.set_buffer(entryBuff) tf.connect("changed", self.tf_changed) vbox.pack_start(hbox) vbox.pack_start(tf) button = gtk.Button("Del") button.connect('clicked', self.button_clicked) self.pack_start(vbox) self.pack_start(button, False, False, 5)
def __init__(self, data, key): self.key = key self.data = data super(NormalEntry, self).__init__(False, 3) hbox = gtk.HBox() hbox.pack_start(gtk.Label("Command")) tf = gtk.Entry() entryBuff_key = gtk.EntryBuffer(self.key, -1) tf.set_buffer(entryBuff_key) tf.connect("changed", self.tf_key_changed) hbox.pack_start(tf) self.pack_start(hbox) hbox = gtk.HBox() hbox.pack_start(gtk.Label("Action")) self.vbox = gtk.VBox() for action in self.data[self.key][0]: self.vbox.pack_start(self.__create_action_entry(action)) button = gtk.Button("Add action") button.connect('clicked', self.add_action_button_clicked) self.vbox.pack_end(button, False, False, 5) hbox.pack_start(self.vbox) self.pack_start(hbox) hbox = gtk.HBox() hbox.pack_start(gtk.Label("Next mode")) tf = gtk.Entry() entryBuff_key = gtk.EntryBuffer(self.data[self.key][1], -1) tf.set_buffer(entryBuff_key) tf.connect("changed", self.tf_mode_changed) hbox.pack_start(tf) self.pack_start(hbox) button = gtk.Button("Delete Entry") button.connect('clicked', self.delete_button_clicked) self.pack_start(button, False, False, 5)
def __init__(self, data, key): self.key = key self.data = data super(TextFieldTextField, self).__init__() tf_key = gtk.Entry() entryBuff_key = gtk.EntryBuffer(self.key, -1) tf_key.set_buffer(entryBuff_key) tf_key.connect("changed", self.tf_key_changed) self.tf_value = gtk.Entry() entryBuff_value = gtk.EntryBuffer(self.data[self.key], -1) self.tf_value.set_buffer(entryBuff_value) self.tf_value.connect("changed", self.tf_value_changed) self.add(tf_key) self.add(self.tf_value)
def __init__(self, data, key): self.key = key self.data = data super(TextFieldTextFieldButton, self).__init__() tf_key = gtk.Entry() entryBuff_key = gtk.EntryBuffer(self.key, -1) tf_key.set_buffer(entryBuff_key) tf_key.connect("changed", self.tf_key_changed) tf_value = gtk.Entry() entryBuff_value = gtk.EntryBuffer(self.data[self.key], -1) tf_value.set_buffer(entryBuff_value) tf_value.connect("changed", self.tf_value_changed) button = gtk.Button("Del") button.connect('clicked', self.button_clicked) self.pack_start(tf_key) self.pack_start(tf_value) self.pack_start(button, False, False, 5)
def fillFramePayloads(self): self.frame_payloads.set_label("Payloads") sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) vbtnbox = gtk.VButtonBox() vbtnbox.set_layout(gtk.BUTTONBOX_START) vbtnbox.set_spacing(1) for plug in self.plug_man.getLoadedPlugins().values(): chkbtn = gtk.CheckButton(plug.getName()) chkbtn.connect("toggled", self.payloadSelected, chkbtn.get_label()) vbtnbox.add(chkbtn) hbox = gtk.HBox(False, 1) hbox.pack_start(gtk.Label("Threads")) hbox.pack_start(self.num_threads) self.launch_button = gtk.Button('Launch', gtk.STOCK_EXECUTE) self.launch_button.connect("clicked", self.launchAttack) self.stop_button = gtk.Button('Stop', gtk.STOCK_STOP) self.stop_button.set_sensitive(False) self.stop_button.connect("clicked", self.stopAttack) self.progressbar = gtk.ProgressBar(adjustment=None) self.num_threads.set_buffer(gtk.EntryBuffer('5', 1)) self.num_threads.set_alignment(0.5) vbtnbox.add(gtk.HSeparator()) vbtnbox.add(self.getCheckButtons(vbtnbox)) vbtnbox.add(hbox) vbtnbox.add(self.launch_button) vbtnbox.add(self.stop_button) vbtnbox.add(self.progressbar) sw.add_with_viewport(vbtnbox) self.frame_payloads.add(sw) self.frame_payloads.show_all()
def __init__(self): win = gtk.Window() win.set_position(gtk.WIN_POS_CENTER) win.set_title("CodeChat") win.set_icon_name("gtk-dialog-info") win.connect("destroy", win_quit) leftEvent = gtk.EventBox() rightEvent = gtk.EventBox() #// main horizontal container, equal 1px spacing mainBox = gtk.HBox(True, 1) leftFrame = gtk.Frame("editor") rightFrame = gtk.Frame("chat") #// left and right containers, spacing not equal leftVBox = gtk.VBox(False, 1) rightVBox = gtk.VBox(False, 1) #// build up the left side editWindow = gtk.ScrolledWindow(None, None) editWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) editWindow.set_shadow_type(gtk.SHADOW_IN) self.EditBuffer = gtksourceview2.Buffer() self.EditLangMgr = gtksourceview2.LanguageManager() self.EditBuffer.set_highlight_syntax(True) self.EditBuffer.set_highlight_matching_brackets(True) lang = self.EditLangMgr.get_language("python") self.EditBuffer.set_language(lang) self.EditView = gtksourceview2.View(self.EditBuffer) self.EditView.set_highlight_current_line(True) self.EditView.set_show_line_numbers(True) self.EditView.modify_font(pango.FontDescription("Monospace 8")) self.EditStatusBar = gtk.Statusbar() editWindow.add(self.EditView) leftVBox.pack_start(editWindow, True, True, 1) leftVBox.pack_end(self.EditStatusBar, False, False, 2) leftFrame.add(leftVBox) #// build up the right side chatWindow = gtk.ScrolledWindow(None, None) chatWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) chatWindow.set_shadow_type(gtk.SHADOW_IN) chatTagTable = gtk.TextTagTable() self.ChatBuffer = gtk.TextBuffer(chatTagTable) self.ChatView = gtk.TextView(self.ChatBuffer) self.ChatView.set_editable(False) self.ChatView.set_cursor_visible(False) chatWindow.add(self.ChatView) chatHBox = gtk.HBox(False, 0) self.MessageBuffer = gtk.EntryBuffer("", -1) self.ChatEntry = gtk.Entry() self.ChatEntry.set_buffer(self.MessageBuffer) self.SendBtn = gtk.Button("send") chatHBox.pack_start(self.ChatEntry, True, True, 0) chatHBox.pack_end(self.SendBtn, False, False, 0) rightVBox.pack_start(chatWindow, True, True, 1) rightVBox.pack_start(chatHBox, False, False, 0) rightFrame.add(rightVBox) leftEvent.add(leftFrame) rightEvent.add(rightFrame) #// set up interface + layout mainBox.pack_start(leftEvent, True, True, 0) mainBox.pack_start(rightEvent, True, True, 0) #// Show the window win.add(mainBox) win.set_size_request(800, 400) win.show_all() self.conclient = client.ConnectionClient() #we need to query the user for username and connection info self.dialog = gtk.Dialog("Connection Dialog", win, gtk.DIALOG_MODAL) ulabel = gtk.Label("username") ilabel = gtk.Label("IP Address:Port") self.uentry = gtk.Entry() self.ientry = gtk.Entry() self.dialog.vbox.add(ulabel) self.dialog.vbox.add(self.uentry) self.dialog.vbox.add(ilabel) self.dialog.vbox.add(self.ientry) self.button = self.dialog.add_button("connect", gtk.RESPONSE_OK) self.button.connect("clicked", self.connect) self.ientry.connect("activate", self.connect) #self.dialog.response(self.connect) self.dialog.show_all() response = self.dialog.run() print("here- after dialog") #instantiate read thread self.read_thread = threading.Thread(None, self.doRead, 'read_thread') self.read_thread.start()