def _initializeComboBoxes(self): """This function permits to update the several combobox in the dialog box.""" vocabParameters = self.currentProject.getConfiguration( ).getVocabularyInferenceParameter formats = Format.getSupportedFormats() projectFormat = vocabParameters( ProjectConfiguration.VOCABULARY_GLOBAL_FORMAT) sizes = [ UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64 ] projectSize = vocabParameters( ProjectConfiguration.VOCABULARY_GLOBAL_UNITSIZE) signs = [Sign.SIGNED, Sign.UNSIGNED] projectSign = vocabParameters( ProjectConfiguration.VOCABULARY_GLOBAL_SIGN) endianesses = [Endianess.BIG, Endianess.LITTLE] projectEndianess = vocabParameters( ProjectConfiguration.VOCABULARY_GLOBAL_ENDIANESS) self.view.initializeComboBoxes(formats, projectFormat, sizes, projectSize, signs, projectSign, endianesses, projectEndianess)
def getProperties(self): properties = PropertyList() configuration = self.getConfiguration() properties.append(Property('workspace', Format.STRING, self.getPath())) prop = Property('name', Format.STRING, self.getName()) prop.setIsEditable(True) properties.append(prop) prop = Property('description', Format.STRING, self.getDescription()) prop.setIsEditable(True) properties.append(prop) properties.append( Property('date', Format.STRING, self.getCreationDate())) properties.append( Property('symbols', Format.DECIMAL, len(self.getVocabulary().getSymbols()))) properties.append( Property('messages', Format.DECIMAL, len(self.getVocabulary().getMessages()))) fields = 0 for sym in self.getVocabulary().getSymbols(): fields = fields + len(sym.getField().getExtendedFields()) properties.append(Property('fields', Format.DECIMAL, fields)) prop = Property( configuration.VOCABULARY_GLOBAL_FORMAT, Format.STRING, configuration.getVocabularyInferenceParameter( configuration.VOCABULARY_GLOBAL_FORMAT)) prop.setIsEditable(True) prop.setPossibleValues(Format.getSupportedFormats()) properties.append(prop) prop = Property( configuration.VOCABULARY_GLOBAL_UNITSIZE, Format.STRING, configuration.getVocabularyInferenceParameter( configuration.VOCABULARY_GLOBAL_UNITSIZE)) prop.setIsEditable(True) prop.setPossibleValues([ UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64 ]) properties.append(prop) prop = Property( configuration.VOCABULARY_GLOBAL_SIGN, Format.STRING, configuration.getVocabularyInferenceParameter( configuration.VOCABULARY_GLOBAL_SIGN)) prop.setIsEditable(True) prop.setPossibleValues([Sign.SIGNED, Sign.UNSIGNED]) properties.append(prop) prop = Property( configuration.VOCABULARY_GLOBAL_ENDIANESS, Format.STRING, configuration.getVocabularyInferenceParameter( configuration.VOCABULARY_GLOBAL_ENDIANESS)) prop.setIsEditable(True) prop.setPossibleValues([Endianess.BIG, Endianess.LITTLE]) properties.append(prop) return properties
def formatEventBox_button_press_event_cb(self, *args): supportedFormats = Format.getSupportedFormats() currentFormat = self.field.getFormat() currentFormatIdx = supportedFormats.index(currentFormat) newFormat = supportedFormats[(currentFormatIdx + 1) % len(supportedFormats)] self.field.setFormat(newFormat) self.setFormat(newFormat) self.messageTableView.updateMessageTableListStore()
def getProperties(self): properties = PropertyList() configuration = self.getConfiguration() properties.append(Property("workspace", Format.STRING, self.getPath())) prop = Property("name", Format.STRING, self.getName()) prop.setIsEditable(True) properties.append(prop) prop = Property("description", Format.STRING, self.getDescription()) prop.setIsEditable(True) properties.append(prop) properties.append(Property("date", Format.STRING, self.getCreationDate())) properties.append(Property("symbols", Format.DECIMAL, len(self.getVocabulary().getSymbols()))) properties.append(Property("messages", Format.DECIMAL, len(self.getVocabulary().getMessages()))) fields = 0 for sym in self.getVocabulary().getSymbols(): fields = fields + len(sym.getField().getExtendedFields()) properties.append(Property("fields", Format.DECIMAL, fields)) prop = Property( configuration.VOCABULARY_GLOBAL_FORMAT, Format.STRING, configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_FORMAT), ) prop.setIsEditable(True) prop.setPossibleValues(Format.getSupportedFormats()) properties.append(prop) prop = Property( configuration.VOCABULARY_GLOBAL_UNITSIZE, Format.STRING, configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_UNITSIZE), ) prop.setIsEditable(True) prop.setPossibleValues( [UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64] ) properties.append(prop) prop = Property( configuration.VOCABULARY_GLOBAL_SIGN, Format.STRING, configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_SIGN), ) prop.setIsEditable(True) prop.setPossibleValues([Sign.SIGNED, Sign.UNSIGNED]) properties.append(prop) prop = Property( configuration.VOCABULARY_GLOBAL_ENDIANESS, Format.STRING, configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_ENDIANESS), ) prop.setIsEditable(True) prop.setPossibleValues([Endianess.BIG, Endianess.LITTLE]) properties.append(prop) return properties
def _initializeComboBoxes(self): """This function permits to update the several combobox in the dialog box.""" vocabParameters = self.currentProject.getConfiguration().getVocabularyInferenceParameter formats = Format.getSupportedFormats() projectFormat = vocabParameters(ProjectConfiguration.VOCABULARY_GLOBAL_FORMAT) sizes = [UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64] projectSize = vocabParameters(ProjectConfiguration.VOCABULARY_GLOBAL_UNITSIZE) signs = [Sign.SIGNED, Sign.UNSIGNED] projectSign = vocabParameters(ProjectConfiguration.VOCABULARY_GLOBAL_SIGN) endianesses = [Endianess.BIG, Endianess.LITTLE] projectEndianess = vocabParameters(ProjectConfiguration.VOCABULARY_GLOBAL_ENDIANESS) self.view.initializeComboBoxes(formats, projectFormat, sizes, projectSize, signs, projectSign, endianesses, projectEndianess)
def build_encoding_submenu(self): """Create a GTK menu which contains entries to edit the visualizations formats of selected layer""" menu = Gtk.Menu() # Format submenu possible_choices = Format.getSupportedFormats() subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getFormat() == value: toggled = True # Create the check item item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeFormat_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("Format")) item.set_submenu(subMenu) item.show() menu.append(item) # Unitsize submenu possible_choices = [ UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64 ] subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getUnitSize() == value: toggled = True item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeUnitSize_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("UnitSize")) item.set_submenu(subMenu) item.show() menu.append(item) # Sign submenu possible_choices = [Sign.SIGNED, Sign.UNSIGNED] subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getSign() == value: toggled = True item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeSign_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("Sign")) item.set_submenu(subMenu) item.show() menu.append(item) # Endianess submenu possible_choices = [Endianess.BIG, Endianess.LITTLE] subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getEndianess() == value: toggled = True item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeEndianess_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("Endianess")) item.set_submenu(subMenu) item.show() menu.append(item) return menu
def build_encoding_submenu(self): """Create a GTK menu which contains entries to edit the visualizations formats of selected layer""" menu = Gtk.Menu() # Format submenu possible_choices = Format.getSupportedFormats() subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getFormat() == value: toggled = True # Create the check item item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeFormat_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("Format")) item.set_submenu(subMenu) item.show() menu.append(item) # Unitsize submenu possible_choices = [UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64] subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getUnitSize() == value: toggled = True item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeUnitSize_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("UnitSize")) item.set_submenu(subMenu) item.show() menu.append(item) # Sign submenu possible_choices = [Sign.SIGNED, Sign.UNSIGNED] subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getSign() == value: toggled = True item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeSign_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("Sign")) item.set_submenu(subMenu) item.show() menu.append(item) # Endianess submenu possible_choices = [Endianess.BIG, Endianess.LITTLE] subMenu = Gtk.Menu() for value in possible_choices: # Compute if its activated toggled = False if self.multipleLayers is False: if self.controller.layers[0].getEndianess() == value: toggled = True item = Gtk.CheckMenuItem(value) item.set_active(toggled) item.show() item.connect("activate", self.controller.changeEndianess_cb, value) subMenu.append(item) item = Gtk.MenuItem(_("Endianess")) item.set_submenu(subMenu) item.show() menu.append(item) return menu