def __init__(self): self.net_hand = NetworkHandler(self.parse_message) #self.cursor_thread_run = True #self.cursor_thread = Thread(target=self.track_cursor) #self.cursor_thread.setDaemon(True) #self.u2_pos = None self.names = {} self.cursor_colors = ['red', 'green', 'blue', 'yellow', 'cyan'] self.autosave_thread = Thread(target=self.autosave_thread) self.autosave_thread.setDaemon(True) current_terminal_buffer_column = 0 current_terminal_buffer_line = 0 self.log = logging.getLogger('jumpy') self.mac = hex(uuid.getnode()) self.is_host = False self.have_perms = False self.mac_name = dict() self.workspace = Workspace() self.create()
def handle_test(args, configs): from Workspace import Workspace from Module import do_test_cycle parser = argparse.ArgumentParser(description=cmd_description_test, usage=cmd_usage_test) if workspace_args is not None: [parser.add_argument(*arg[0], **arg[1]) for arg in workspace_args] my_args = parser.parse_args(args) wksp = Workspace(my_args, configs=configs) if wksp.num_modules > 20: from Module import do_test_cycle # Start a parallel process queue start = time.time() multi_proc(do_test_cycle, wksp.module_objs) print(f'Time taken = {time.time() - start:.2f}') # run( do_test_cycle, wksp.module_objs ) else: # Runs tests with current process start = time.time() wksp.find_wksp_test_src_files() wksp.find_wksp_tests_and_groups() wksp.gen_wksp_test_runners() wksp.run_wksp_tests() wksp.calculate_test_result_totals() wksp.print_test_summary() print(f'Time taken = {time.time() - start:.10f}')
def __init__(self, semObject, className, modelPath=None): # Use the AToM3 Tkinter root window self.className = className root = self.rootInitilization(semObject, modelPath) if (not root): return self.root = root self.mainHandler = MainHandler.MainHandler(self) root.bind("<Key>", self.mainHandler.onKey) root.bind("<Shift-Key>", self.mainHandler.onShiftKey) root.bind("<Control-Key>", self.mainHandler.onControlKey) zoom = 1.0 self.menuBar = Tools.MenuBar(root, self, self.mainHandler) #goes to top by itself self.statusBar = Tools.StatusBar(root, "", zoom, 0, 0) #goes to bottom by itself self.colorSelector = Colors.ColorSelector( root, self.mainHandler) #goes to bottom by itself self.toolFrame = Tkinter.Frame(root, relief=Tkinter.RAISED, bd=1) self.toolSelector = Tools.ToolSelector(self.toolFrame, self.mainHandler, Tkinter.TOP) self.outlineFillOptionSelector = Tools.OutlineFillOptionSelector( self.toolFrame, self.mainHandler, Tkinter.TOP) self.lineWidthSelector = Tools.LineWidthSelector( self.toolFrame, self.mainHandler, Tkinter.TOP) self.toolFrame.pack(side=Tkinter.LEFT) self.workspace = Workspace(self, self.CANVAS_SIZE_TUPLE[2], self.CANVAS_SIZE_TUPLE[3], self.CANVAS_SIZE_TUPLE[2], self.CANVAS_SIZE_TUPLE[3], self.mainHandler, zoom) #goes to the right by itself self.workspace.setZoom(zoom, 0, 0) self.canvas = self.workspace.getCanvas() self.scripting = Scripting() ## self.GFs = self.open() self.GFs = [] self.extendedInitilization(semObject) self.clipboardList = [] self.undoStack = [] self.mainHandler.start() self.compositionVisitor = GFVisitors.CompositionVisitor(self) self.colorVisitor = GFVisitors.ColorVisitor() self.widthVisitor = GFVisitors.WidthVisitor() self.optionVisitor = GFVisitors.OptionVisitor(self) # Carefully try to load the GF model (may fail for random reasons) try: self.GFs = self.open() except: raise
def handle_list(args, configs): from Workspace import Workspace parser = argparse.ArgumentParser(description=cmd_description_list, usage=cmd_usage_list) if workspace_args is not None: [parser.add_argument(*arg[0], **arg[1]) for arg in workspace_args] my_args = parser.parse_args(args) wksp = Workspace(args=my_args, configs=configs) wksp.print_module_names()
# test_prm.prm(10, start, goal, False) # #test_arm.generate_graphic() # #3 arm segments # start = (0, 0, 0) # goal = (3*math.pi/2, 3*math.pi/2, 0) # lengths = [2, 5, 2] # obstacles = [[0, 4, 1, 6], [4, 4, 2, 2]] # test_arm = Workspace(start, lengths, obstacles) # #test_arm.generate_graphic() # test_prm = PRM(test_arm) # #test_prm.print_prm() # test_prm.prm(40, start, goal, True) # #test_arm.generate_graphic() # #4 arm segments start = (0, 0, 0, 0) goal = (3 * math.pi / 2, 3 * math.pi / 2, 0, math.pi / 2) lengths = [2, 2, 2, 2] obstacles = [[-2, -1, 1, 6], [4, 4, 2, 2]] test_arm = Workspace(start, lengths, obstacles) #test_arm.generate_graphic() test_prm = PRM(test_arm) #test_prm.print_prm() test_prm.prm(40, start, goal, True) #test_arm.generate_graphic()
# Contains workspace, display, navigation, display group and user configuration classes to be used by the framework. # import guacamole libraries import avango import avango.gua # import framework libraries from DisplayGroup import * from PhysicalDisplay import * from Portal import * from Workspace import Workspace from SteeringNavigation import SteeringNavigation from StaticNavigation import StaticNavigation ## Create Workspaces first ## vr_lab_rear = Workspace('VR-Lab-Rear', avango.gua.make_trans_mat(0.0, 0.043, 0.0)) vr_lab_front = Workspace('VR-Lab-Front', avango.gua.make_trans_mat(0.0, 0.043, 0.0)) video_visibility_table = { "dlp_wall": { "lcd_wall": True, "portal": False }, "lcd_wall": { "dlp_wall": True, "portal": False }, "portal": { "dlp_wall": True, "lcd_wall": True
from Workspace import Workspace from Project import Project w1 = Workspace() class ProjectManager(): def guiInfo(self, workspace_name, path, project_name, desc, layout, getter): project = Project() if (workspace_name != None): if (path != None): w1.setPath(path) w1.setName(workspace_name) Workspace.current = w1 else: print("Invalid1") return elif (project_name != None): if (desc != None): project.setName(project_name) project.setDesc(desc) project.createProject() Project.current = project else: project.loadProject(project_name) return #elif(layout != None): # Project.getLayout() else: if (getter == 0):
def initUI(self): self.menuBar = MenuBar(self) self.setMenuBar(self.menuBar) self.workspace = Workspace(self) self.setCentralWidget(self.workspace)
## @file # Contains workspace, display, navigation, display group and user configuration classes to be used by the framework. # import guacamole libraries import avango import avango.gua # import framework libraries from Display import * from Workspace import Workspace from SteeringNavigation import SteeringNavigation from StaticNavigation import StaticNavigation ## Create Workspaces first ## atalante = Workspace('atalante', avango.gua.make_trans_mat(0.0, 0.043, 0.0)) workspaces = [atalante] ## Create Navigation instances ## spacemouse_navigation = SteeringNavigation() spacemouse_navigation.my_constructor( STARTING_MATRIX = avango.gua.make_trans_mat(0, 0, 0) , STARTING_SCALE = 1.0 , INPUT_DEVICE_TYPE = 'Spacemouse' , INPUT_DEVICE_NAME = 'device-spacemouse' , NO_TRACKING_MAT = avango.gua.make_trans_mat(0.0, 1.2, 0.6) , GROUND_FOLLOWING_SETTINGS = [True, 0.75] , MOVEMENT_TRACES = True , INVERT = False , AVATAR_TYPE = 'joseph' , DEVICE_TRACKING_NAME = None)
class PDMLview(Gtk.Window): currentWorkspace = Workspace("", "") sessionNum = 1 def pdmlDesign(self, workspace, mainwindow): self.mainwindow = mainwindow self.currentWorkspace = workspace # Starting box for pdmlView pdmlBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) pdmlBox.set_homogeneous(True) # Starting list box for pdmlVire pdmlListBox = Gtk.ListBox() # Adding listbox to box pdmlBox.add(pdmlListBox) # title "PDML View" area titleBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) labelPDML = Gtk.Label("PDML View") titleBox.add(labelPDML) # child is packed into box (item, expand, fill, padding, packtype) titleBox.set_child_packing(labelPDML, True, True, 100, 0) # Homogeneous titleBox.set_homogeneous(True) # Adding into primary list box pdmlListBox.add(titleBox) self.field = FieldArea.FieldArea() # pdml menu menu = self.pdmlMenu() pdmlListBox.add(menu) # filter area filterTab = self.filterArea(self.currentWorkspace) pdmlListBox.add(filterTab) # grid.add(filterTab) # pdmlListBox.add(grid) # packet area self.pckt = PacketArea.PacketArea() self.packetArea = self.pckt.Tabs(self.currentWorkspace) #grid.add(packetArea) pdmlListBox.add(self.packetArea) bottomPart = self.bottomPDMLView() pdmlListBox.add(bottomPart) #thisListBox.add(packetTab) #thisListBox.add(bottomTab) return pdmlBox def pdmlMenu(self): header = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) # WARNING THIS BREAKS LAYOUT #header.set_homogeneous(True) # text boxes self.newStateNameEntry = Gtk.Entry() self.newStateNameEntry.set_placeholder_text("New PDML State Name") renameCurrentEntry = Gtk.Entry() renameCurrentEntry.set_placeholder_text( "Rename Current PDML State Name") # buttons saveNewBtn = Gtk.Button(label="Save as New\nPDML State") saveCurrentBtn = Gtk.Button(label="Save Current\nPDML State") closeCurrentBtn = Gtk.Button(label="Close Current\nPDML State") deleteCurrentBtn = Gtk.Button(label="Delete Current\nPDML State") renameCurrentBtn = Gtk.Button(label="Rename Current\nPDML State") header.add(self.newStateNameEntry) header.add(saveNewBtn) header.add(saveCurrentBtn) header.add(closeCurrentBtn) header.add(deleteCurrentBtn) header.add(renameCurrentEntry) header.add(renameCurrentBtn) saveNewBtn.connect("clicked", self.on_save_clicked, self.currentWorkspace) saveCurrentBtn.connect("clicked", self.on_savecurrent_clicked, self.currentWorkspace) return header def filterArea(self, currentWorkspace): # Starting box for filter filterBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) filterBox.set_homogeneous(True) # Starting list box for title filterListBox = Gtk.ListBox() # Adding listbox to box filterBox.add(filterListBox) # title "PDML View" area titleBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) labelTitle = Gtk.Label() labelTitle.set_markup("<u>Filter Area</u>") labelTitle.set_justify(Gtk.Justification.LEFT) titleBox.add(labelTitle) # child is packed into box (item, expand, fill, padding, packtype) titleBox.set_child_packing(labelTitle, True, True, 0, 0) # Adding into primary list box filterListBox.add(titleBox) # Starting second row lineBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) #nameLabel.set_justify(Gtk.Justification.LEFT) filterLabel = Gtk.Label("Filter") # buttons applyNewBtn = Gtk.Button("Apply") clearBtn = Gtk.Button("Clear") saveBtn = Gtk.Button("Save") applyFilterBtn = Gtk.Button("Apply") # text box (entry) newFilter = Gtk.Entry() newFilter.set_placeholder_text("Filter Expression") # drop down # TODO HAVE TO ESTABLISH THE filters saved OF THE DROPDOWN filters = FilterContainer() filter_store = Gtk.ListStore(str) for filterT in filters.filterList: filter_store.append([filterT]) savedFilters = Gtk.ComboBox().new_with_model(filter_store) #savedFilters.connect("changed", self.on_filter_combo_changed) renderer_text = Gtk.CellRendererText() savedFilters.pack_start(renderer_text, True) savedFilters.add_attribute(renderer_text, "text", 0) # # adding second line into box lineBox.add(filterLabel) lineBox.pack_start(newFilter, True, True, 10) lineBox.pack_start(applyNewBtn, True, True, 0) lineBox.pack_start(clearBtn, True, True, 0) lineBox.pack_start(saveBtn, True, True, 0) lineBox.pack_start(savedFilters, True, True, 0) lineBox.pack_start(applyFilterBtn, True, True, 0) applyFilterBtn.connect("clicked", self.on_filter_apply_clicked, savedFilters, currentWorkspace) filterListBox.add(lineBox) return filterBox def on_filter_apply_clicked(self, widget, combo, workspace): tree_iter = combo.get_active_iter() if tree_iter is not None: model = combo.get_model() filterT = model[tree_iter][0] #print("Selected: filter=%s" % filterT) else: filterT = "-1" dissector = Dissector.Dissector("", "") pdml = PDML.PDML() namePDML = dissector.convert(workspace.pcap, workspace.path) pdml.setName(namePDML) pdml.parse(workspace.path, filterT) pdml.setName("State" + str(self.sessionNum)) workspace.sessions[0].addPDML(pdml) self.listSessions = self.getListSession() self.sessionNum = self.sessionNum + 1 self.mainwindow.on_session_update() print(self.pckt.createPDMLview(workspace.sessions[0].getLatest())) self.pckt.update_pdml() self.field.update_fields() def on_save_clicked(self, widget, workspace): textnew = self.newStateNameEntry.get_text() #print(textnew) dissector = Dissector.Dissector("", "") pdml = PDML.PDML() namePDML = dissector.convert(workspace.pcap, workspace.path) pdml.setName(namePDML) pdml.parse(workspace.path, "-1") pdml.setName(textnew) workspace.sessions[0].addPDML(pdml) self.listSessions = self.getListSession() #self.sessionNum = self.sessionNum + 1; self.mainwindow.on_session_update() def on_savecurrent_clicked(self, widget, workspace): dissector = Dissector.Dissector("", "") pdml = PDML.PDML() namePDML = dissector.convert(workspace.pcap, workspace.path) pdml.setName(namePDML) pdml.parse(workspace.path, "-1") pdml.setName("State" + str(self.sessionNum)) workspace.sessions[0].addPDML(pdml) self.listSessions = self.getListSession() self.sessionNum = self.sessionNum + 1 self.mainwindow.on_session_update() def bottomPDMLView(self): box = Gtk.Box() grid = Gtk.Grid() box.add(grid) # Field Area self.fieldArea = self.field.Tabs() grid.attach(self.fieldArea, 0, 1, 1, 1) # Message Type Area mta = MessageTypeArea.MessageTypeArea() messTypeArea = mta.Tabs() grid.attach(messTypeArea, 2, 1, 1, 1) buttonBox = Gtk.VBox() plusButton = Gtk.Button("+") minusButton = Gtk.Button("-") buttonBox.add(plusButton) buttonBox.add(minusButton) grid.attach(buttonBox, 1, 1, 1, 1) return box def getListSession(self): return self.currentWorkspace.getListSession()
def main(): name = os.path.basename(os.getcwd()) # Parse arguments parser = argparse.ArgumentParser( prog='Pygling', description='Pygling C++ workspace generator.', prefix_chars='--', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("action", type=str, help="Action", choices=["configure", "build", "install"]) parser.add_argument("-p", "--platform", default='all', type=str, help="Target platform") parser.add_argument("-s", "--source", default='.', type=str, help="Project source path") parser.add_argument("-o", "--output", default='projects', type=str, help="Output path") parser.add_argument("-n", "--name", default=name, type=str, help="Workspace (solution) name") parser.add_argument("-a", "--arch", default='default', type=str, help="Target build architecture") parser.add_argument("-x", "--std", default='cxx98', type=str, help="C++ standard", choices=['cxx99', 'cxx11']) parser.add_argument("-c", "--configuration", default='Release', type=str, help="Build configuration") parser.add_argument("--package", type=str, help="Application package identifier") parser.add_argument("--platformSdk", type=str, help="Platform SDK identifier") parser.add_argument("--xcteam", type=str, help="Xcode provisioning profile to be used") # Check action args, unknown = parser.parse_known_args() workspace = Workspace(args.name, args.source, args.output, args, unknown) if args.action == 'configure': workspace.configure(args.platform) elif args.action == 'build': workspace.build(args.platform) elif args.action == 'install': workspace.install(args.platform)
## @file # Contains workspace, display, navigation, display group and user configuration classes to be used by the framework. # import guacamole libraries import avango import avango.gua # import framework libraries from Display import * from Workspace import Workspace from SteeringNavigation import SteeringNavigation from StaticNavigation import StaticNavigation ## Create Workspaces first ## artemis = Workspace('artemis', avango.gua.make_trans_mat(0.0, 0.043, 0.0)) workspaces = [artemis] ## Create Navigation instances ## spacemouse_navigation = SteeringNavigation() spacemouse_navigation.my_constructor( STARTING_MATRIX=avango.gua.make_trans_mat(0, 0, 0), STARTING_SCALE=1.0, INPUT_DEVICE_TYPE='Spacemouse', INPUT_DEVICE_NAME='device-spacemouse', NO_TRACKING_MAT=avango.gua.make_trans_mat(0.0, 1.2, 0.6), GROUND_FOLLOWING_SETTINGS=[True, 0.75], MOVEMENT_TRACES=True, INVERT=False, AVATAR_TYPE='joseph',
def add_workspace(self, name=""): self.workspace = Workspace(name) # create empty workspace return self.workspace
from SignalRegistry import get_registry from Workspace import Workspace from output import play_signal from util.frames import to_frames logging.basicConfig(level=logging.INFO) log = logging.getLogger(__name__) fs = 44100 registry = get_registry() graph = SignalGraph() manager = SignalManager(SignalCache) workspace = Workspace("resources/signals.json", manager, graph, registry) workspace.initialize() signals = manager.signals restored_signal = manager.get_signal('dilated:2') dilated_signal = manager.get_signal('dilated:0.5') offset_signal = manager.get_signal('offset:2') base_signal = manager.get_signal('wav') var_offset_signal = manager.get_signal('var_offset') sine_signal = manager.get_signal('sine') selected_signal = var_offset_signal dur = to_frames(offset_signal.get_range(fs)[1])
def menuNew_activate(widget, data): data.mainVBox.mainNotebook.add(Workspace())
def on_launch_clicked(self, widget, path, name): workspace = Workspace(name.get_text(), path.get_text()) from OpenPCAP import OpenPCAP win = OpenPCAP(workspace) win.show_all()
class MainWindow(Gtk.Window): currentWorkspace = Workspace("","") def __init__(self, workspace): Gtk.Window.__init__(self, title="NTSBG") self.currentWorkspace = workspace print("workspace name= " + self.currentWorkspace.name) self.pdml = PDMLview.PDMLview() self.set_border_width(10) # self.set_default_size(s.get_width(), s.get_height()) # initialize header bar header = self.header() # initialize listbox design listMain = Gtk.ListBox() listMain.set_selection_mode(Gtk.SelectionMode.NONE) self.add(listMain) # initialize stages buttons stages = self.stagesButtons() listMain.add(stages) # initialize views views = self.viewsDesign(self.currentWorkspace) listMain.add(views) def header(self): hb = Gtk.HeaderBar() hb.props.title = "Network Traffic Based Software Generation" self.set_titlebar(hb) button = Gtk.Button(label="x") button.set_relief(Gtk.ReliefStyle.NONE) button.connect("clicked", Gtk.main_quit) hb.pack_end(button) buttonBox = self.menuBox() hb.pack_end(buttonBox) return hb def menuBox(self): buttonBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) Gtk.StyleContext.add_class(buttonBox.get_style_context(), "linked") buttonBox.set_spacing(10) # init Header Buttons Menu createBtn = Gtk.Button(label="Create Session") openBtn = Gtk.Button(label="Open Session") closeBtn = Gtk.Button(label="Close Session") switchBtn = Gtk.Button(label="Switch Workspace") pcapBtn = Gtk.Button(label="Open PCAP") terminalBtn = Gtk.Button(label="Terminal") # Connecting buttons createBtn.connect("clicked", self.on_new_session_clicked) pcapBtn.connect("clicked", self.on_open_pcap_clicked) openBtn.connect("clicked", self.on_open_session_clicked) buttonBox.add(createBtn) buttonBox.add(openBtn) buttonBox.add(closeBtn) buttonBox.add(switchBtn) buttonBox.add(pcapBtn) buttonBox.add(terminalBtn) return buttonBox def stagesButtons(self): stages = Gtk.ListBoxRow() # initialize stages section stage1 = Gtk.Button(label="Stage 1: Configuration and Setup") stage2 = Gtk.Button(label="Stage 2: Message Analysis") stage3 = Gtk.Button(label="Stage 3: Sequencing") stage4 = Gtk.Button(label="Stage 4: Code Generation") stageBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) Gtk.StyleContext.add_class(stageBox.get_style_context(), "linked") stageBox.set_homogeneous(True) stageBox.set_spacing(10) stageBox.add(stage1) stageBox.add(stage2) stageBox.add(stage3) stageBox.add(stage4) stages.add(stageBox) return stages def viewsDesign(self, currentWorkspace): views = Gtk.ListBoxRow() sessionsView = self.sessionsDesign(currentWorkspace) pdmlView = self.pdml.pdmlDesign(currentWorkspace, self) print("THIS IS THE CURRENT LIST ALV") self.sessionList = self.pdml.getListSession() views.add(sessionsView) sessionsView.pack_start(pdmlView, True, True, 0) return views def sessionsDesign(self, currentWorkspace): sessionsViewCol = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) thisListBox = Gtk.ListBox() sessionsViewCol.add(thisListBox) # Title "Sessions View" box titleBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50) labelSessions = Gtk.Label("Sessions View") titleBox.add(labelSessions) titleBox.set_child_packing(labelSessions, 1, 1, 80, 0) # Sessions View tab sessionsTab = self.sessionsArea() # Tag Area tagAreaTab = self.tagArea(currentWorkspace) thisListBox.add(titleBox) thisListBox.add(sessionsTab) thisListBox.add(tagAreaTab) return sessionsViewCol def sessionsArea(self): sessionsTab = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) # TODO DON'T KNOW HOW TO DO SESSIONS HELP grid = Gtk.Grid() sessionsTab.add(grid) grid.set_row_spacing(5) # workspaceLabel = Gtk.Button(label="Workspace X") # workspaceLabel.set_sensitive(False) # grid.add(workspaceLabel) self.hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) self.hbox.store = Gtk.TreeStore(str, bool) for i in range(len(work)): piter = self.hbox.store.append(None, [work[i][0], False]) j = 1 while j < len(work[i]): self.hbox.store.append(piter, work[i][j]) j += 1 self.view = Gtk.TreeView() self.view.set_model(self.hbox.store) renderer = Gtk.CellRendererToggle() column_in_size = Gtk.TreeViewColumn("", renderer, active=1) self.view.append_column(column_in_size) renderer_frame = Gtk.CellRendererText() column_frame = Gtk.TreeViewColumn(self.currentWorkspace.name, renderer_frame, text=0) self.view.append_column(column_frame) # initializing box where packet will be scroll_window = Gtk.ScrolledWindow() grid.add(scroll_window) scroll_window.add(self.view) scroll_window.set_min_content_width(200) scroll_window.set_min_content_height(200) return sessionsTab def tagArea(self, workspace): tagAreaTab = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) grid = Gtk.Grid() tagAreaTab.add(grid) grid.set_column_spacing(10) grid.set_row_spacing(5) # title tagLabel = Gtk.Label() tagLabel.set_markup("<u>Tag Area</u>") # labels savedLabel = Gtk.Label("Saved Tag") nameLabel = Gtk.Label("Tag Name") fieldLabel = Gtk.Label("Tag Field") descriptionLabel = Gtk.Label("Tag Description") # drop down menu self.tagListWorkspace = workspace.tagContainer self.tag_store = Gtk.ListStore(str) for currTag in self.tagListWorkspace.tagList: tagStr = currTag.name print(tagStr) self.tag_store.append([tagStr]) self.savedCombo = Gtk.ComboBox().new_with_model(self.tag_store) renderer_text = Gtk.CellRendererText() self.savedCombo.pack_start(renderer_text, True) self.savedCombo.add_attribute(renderer_text, "text", 0) self.savedCombo.connect("changed", self.on_tag_changed) # text boxes self.nameEntry = Gtk.Entry() self.fieldEntry = Gtk.Entry() self.descriptionEntry = Gtk.Entry() # buttons buttonBox = Gtk.Box() buttonBox.set_homogeneous(True) buttonBox.set_spacing(5) updateBtn = Gtk.Button(label="Update") cancelBtn = Gtk.Button(label="Cancel") buttonBox.pack_end(cancelBtn, True, True, 0) buttonBox.add(updateBtn) leftBox = Gtk.VBox() leftBox.add(savedLabel) leftBox.add(nameLabel) leftBox.add(fieldLabel) leftBox.add(descriptionLabel) rightBox = Gtk.VBox() rightBox.pack_start(self.savedCombo, True, True, 5) rightBox.pack_start(self.nameEntry, True, True, 0) rightBox.pack_start(self.fieldEntry, True, True, 0) rightBox.pack_start(self.descriptionEntry, True, True, 0) rightBox.pack_start(buttonBox, True, True, 0) # adding to grid grid.add(tagLabel) grid.attach_next_to(leftBox, tagLabel, Gtk.PositionType.BOTTOM, 1, 1) grid.attach_next_to(rightBox, leftBox, Gtk.PositionType.RIGHT, 1, 1) updateBtn.connect("clicked", self.on_tag_update) return tagAreaTab def on_new_session_clicked(self, widget): from NewSession import NewSession win = NewSession() win.show_all() def on_open_pcap_clicked(self, widget): from OpenPCAP import OpenPCAP win = OpenPCAP() win.show_all() def on_open_session_clicked(self, widget): from OpenSession import OpenSession win = OpenSession() win.show_all() def on_tag_changed(self, widget): tree_iter = widget.get_active_iter() if tree_iter is not None: model = widget.get_model() currTag = model[tree_iter][0] print("Selected: tag=%s" % currTag) taglist = self.currentWorkspace.tagContainer self.tagObj = taglist.getTag(currTag) self.nameEntry.set_text(self.tagObj.name) self.fieldEntry.set_text(self.tagObj.field) self.descriptionEntry.set_text(self.tagObj.annotation) def on_tag_update(self, widget): currName = self.nameEntry.get_text() currField = self.fieldEntry.get_text() currAnnot = self.descriptionEntry.get_text() self.tagObj.name = currName self.tagObj.field = currField self.tagObj.annotation = currAnnot self.tag_store.clear() for currTag in self.tagListWorkspace.tagList: tagStr = currTag.name self.tag_store.append([tagStr]) self.savedCombo = Gtk.ComboBox().new_with_model(self.tag_store) def on_session_update(self): work = self.pdml.getListSession() self.hbox.store.clear() for i in range(len(work)): piter = self.hbox.store.append(None, [work[i][0], False]) j = 1 while j < len(work[i]): self.hbox.store.append(piter, work[i][j]) j += 1 self.view = Gtk.TreeView() self.view.set_model(self.hbox.store)