本文整理汇总了Python中netzob.Common.ResourcesConfiguration.ResourcesConfiguration.getLocaleLocation方法的典型用法代码示例。如果您正苦于以下问题:Python ResourcesConfiguration.getLocaleLocation方法的具体用法?Python ResourcesConfiguration.getLocaleLocation怎么用?Python ResourcesConfiguration.getLocaleLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netzob.Common.ResourcesConfiguration.ResourcesConfiguration
的用法示例。
在下文中一共展示了ResourcesConfiguration.getLocaleLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _initResourcesAndLocales
# 需要导入模块: from netzob.Common.ResourcesConfiguration import ResourcesConfiguration [as 别名]
# 或者: from netzob.Common.ResourcesConfiguration.ResourcesConfiguration import getLocaleLocation [as 别名]
def _initResourcesAndLocales(self):
# Initialize resources
logging.debug("+ Initialize resources...")
if not ResourcesConfiguration.initializeResources():
logging.fatal("Error while configuring the resources of Netzob")
sys.exit()
# Initialiaze gettext
gettext.bindtextdomain("netzob", ResourcesConfiguration.getLocaleLocation())
gettext.textdomain("netzob")
locale.bindtextdomain("netzob", ResourcesConfiguration.getLocaleLocation())
locale.textdomain("netzob")
try:
locale.getlocale()
except:
logging.exception("setlocale failed, resetting to C")
locale.setlocale(locale.LC_ALL, "C")
示例2: __init__
# 需要导入模块: from netzob.Common.ResourcesConfiguration import ResourcesConfiguration [as 别名]
# 或者: from netzob.Common.ResourcesConfiguration.ResourcesConfiguration import getLocaleLocation [as 别名]
def __init__(self):
# Command line commands
parser = CommandLine.get_parser()
opts, args = parser.parse_args()
gettext.bindtextdomain("netzob", ResourcesConfiguration.getLocaleLocation())
gettext.textdomain("netzob")
try:
locale.getlocale()
except:
logging.exception("setlocale failed, resetting to C")
locale.setlocale(locale.LC_ALL, "C")
(status, version) = DepCheck.test_lxml()
if status == False:
logging.fatal("Version of python-lxml ({0}) is too old for Netzob. Please install a recent version (>= 2.3)".format(version))
sys.exit()
# First we initialize and verify all the resources
if not ResourcesConfiguration.initializeResources():
logging.fatal("Error while configuring the resources of Netzob")
sys.exit()
if opts.workspace == None:
workspace = str(ResourcesConfiguration.getWorkspaceFile())
else:
workspace = opts.workspace
logging.debug("The workspace: {0}".format(str(workspace)))
# loading the workspace
self.currentWorkspace = (Workspace.loadWorkspace(workspace))
# the semi-automatic loading of the workspace has failed (second attempt)
if self.currentWorkspace == None:
# we force the creation (or specification) of the workspace
if not ResourcesConfiguration.initializeResources(True):
logging.fatal("Error while configuring the resources of Netzob")
sys.exit()
workspace = str(ResourcesConfiguration.getWorkspaceFile())
logging.debug("The workspace: {0}".format(str(workspace)))
# loading the workspace
self.currentWorkspace = (Workspace.loadWorkspace(workspace))
if self.currentWorkspace == None:
logging.fatal("Stopping the execution (no workspace computed)!")
sys.exit()
self.currentProject = self.currentWorkspace.getLastProject()
# Second we create the logging infrastructure
LoggingConfiguration().initializeLogging(self.currentWorkspace)
# Now we load all the available plugins
NetzobPlugin.loadPlugins(self)
# create logger with the given configuration
self.log = logging.getLogger('netzob.py')
self.log.info(_("Starting netzob"))
# Main window definition
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
self.set_default_size(800, 600)
self.set_title(_("Netzob: Inferring communication protocols"))
self.set_icon_from_file(("%s/logo.png" %
ResourcesConfiguration.getStaticResources()))
self.connect("delete_event", self.evnmtDelete)
self.connect("destroy", self.destroy)
main_vbox = gtk.VBox(False, spacing=0)
# Create and display the menu
self.menu = Menu(self)
menubar = self.menu.getMenuBar(self)
menubar.show()
self.menu.update()
main_vbox.pack_start(menubar, False, True, 0)
# Notebook definition
self.notebook = gtk.Notebook()
self.notebook.set_tab_pos(gtk.POS_TOP)
self.notebook.connect("switch-page", self.notebookFocus)
main_vbox.pack_start(self.notebook, True, True, 0)
self.pageList = []
# Adding the different notebook
self.modelization = UImodelization(self)
self.grammarInference = UIGrammarInference(self)
# self.fuzzing = UIfuzzing(self)
self.simulator = UISimulator(self)
self.pageList.append([_("Vocabulary inference"), self.modelization])
self.pageList.append([_("Grammar inference"), self.grammarInference])
# self.pageList.append(["Fuzzing", self.fuzzing])
self.pageList.append([_("Simulator"), self.simulator])
for page in self.pageList:
self.notebook.append_page(page[1].panel, gtk.Label(page[0]))
#.........这里部分代码省略.........