コード例 #1
0
    def __init__(self, item, treeController, variable):
        """Constructor of VariableMovingController:
                Called by a click on the tree view of all variables.

                @type item: Gtk.Menuitem
                @param item: the menu item that calls this constructor.
                @type treeController: VariableTreeController
                @param treeController: the controller of the tree view which cause this controller's view to appear.
                @type variable: netzob.Common.MMSTD.Dictionary.Variables.AbstractVariable
                @param variable: the variable that will be modified/to which we will add a child.
        """
        self.treeController = treeController
        self.netzob = self.treeController.netzob
        self.variable = variable
        self.view = VariableMovingView(self)
        self.initCallBacks()
        self.runDialog()
コード例 #2
0
ファイル: VariableController.py プロジェクト: lindi2/netzob
class VariableMovingController(object):
    """VariableMovingController:
            Manage a view that allows the user to move a variable to a specified position.
    """

    def __init__(self, item, treeController, variable):
        """Constructor of VariableMovingController:
                Called by a click on the tree view of all variables.

                @type item: Gtk.Menuitem
                @param item: the menu item that calls this constructor.
                @type treeController: VariableTreeController
                @param treeController: the controller of the tree view which cause this controller's view to appear.
                @type variable: netzob.Common.MMSTD.Dictionary.Variables.AbstractVariable
                @param variable: the variable that will be modified/to which we will add a child.
        """
        self.treeController = treeController
        self.netzob = self.treeController.netzob
        self.variable = variable
        self.view = VariableMovingView(self)
        self.initCallBacks()
        self.runDialog()

    def initCallBacks(self):
        """initCallbacks:
                Init the callbacks.
        """
        self.view.getWidg("applyButton").connect("clicked", self.validateChanges)

    def runDialog(self):
        """runDialog:
                Run a dialog that allows to move a variable.
        """
        dialog = self.view.getWidg("dialog")
        self.view.getWidg("entry").set_text(str(self.variable.getFathers()[0].indexOfChild(self.variable)))
        dialog.show_all()
        dialog.run()

    def validateChanges(self, widget):
        """validateChanges:
                Validate the changes that a user has done on a variable.
                Called by a click on the apply button.

                @type widget: Gtk.widget
                @param widget: the widget which calls this function.
        """
        position = int(self.view.getWidg("entry").get_text())

        # Move the variable entry in the tree view.
        entry = self.treeController.dictEntry[self.variable.getID()]
        self.treeController.treestore.move_before(entry, self.treeController.dictEntry[self.variable.getFathers()[0].getChildren()[position].getID()])

        # Move the variable.
        self.variable.getFathers()[0].moveChild(self.variable, position)

        self.view.getWidg("dialog").destroy()
コード例 #3
0
class VariableMovingController(object):
    """VariableMovingController:
            Manage a view that allows the user to move a variable to a specified position.
    """

    def __init__(self, item, treeController, variable):
        """Constructor of VariableMovingController:
                Called by a click on the tree view of all variables.

                @type item: Gtk.Menuitem
                @param item: the menu item that calls this constructor.
                @type treeController: VariableTreeController
                @param treeController: the controller of the tree view which cause this controller's view to appear.
                @type variable: netzob.Common.MMSTD.Dictionary.Variables.AbstractVariable
                @param variable: the variable that will be modified/to which we will add a child.
        """
        self.treeController = treeController
        self.netzob = self.treeController.netzob
        self.variable = variable
        self.view = VariableMovingView(self)
        self.initCallBacks()
        self.runDialog()

    def initCallBacks(self):
        """initCallbacks:
                Init the callbacks.
        """
        self.view.getWidg("applyButton").connect("clicked", self.validateChanges)

    def runDialog(self):
        """runDialog:
                Run a dialog that allows to move a variable.
        """
        dialog = self.view.getWidg("dialog")
        self.view.getWidg("entry").set_text(str(self.variable.getFathers()[0].indexOfChild(self.variable)))
        dialog.show_all()
        dialog.run()

    def validateChanges(self, widget):
        """validateChanges:
                Validate the changes that a user has done on a variable.
                Called by a click on the apply button.

                @type widget: Gtk.widget
                @param widget: the widget which calls this function.
        """
        position = int(self.view.getWidg("entry").get_text())

        # Move the variable entry in the tree view.
        entry = self.treeController.dictEntry[self.variable.getID()]
        self.treeController.treestore.move_before(entry, self.treeController.dictEntry[self.variable.getFathers()[0].getChildren()[position].getID()])

        # Move the variable.
        self.variable.getFathers()[0].moveChild(self.variable, position)

        self.view.getWidg("dialog").destroy()
コード例 #4
0
ファイル: VariableController.py プロジェクト: lindi2/netzob
    def __init__(self, item, treeController, variable):
        """Constructor of VariableMovingController:
                Called by a click on the tree view of all variables.

                @type item: Gtk.Menuitem
                @param item: the menu item that calls this constructor.
                @type treeController: VariableTreeController
                @param treeController: the controller of the tree view which cause this controller's view to appear.
                @type variable: netzob.Common.MMSTD.Dictionary.Variables.AbstractVariable
                @param variable: the variable that will be modified/to which we will add a child.
        """
        self.treeController = treeController
        self.netzob = self.treeController.netzob
        self.variable = variable
        self.view = VariableMovingView(self)
        self.initCallBacks()
        self.runDialog()