Exemplo n.º 1
0
 def OnStatusMessage(self, browser, value):
     event = wx.CommandEvent()
     event.SetString(value)
     if self.htmlwin: self.htmlwin.on_status_message(event)
Exemplo n.º 2
0
 def OnMouseDown(self, event):
     clickEvent = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
     clickEvent.SetEventObject(self)
     self.GetEventHandler().ProcessEvent(clickEvent)
Exemplo n.º 3
0
 def __PostEvent(self):
     """Post a button event to parent of this control"""
     bevt = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
     bevt.SetEventObject(self)
     bevt.SetString(self.GetLabel())
     wx.PostEvent(self.GetParent(), bevt)
Exemplo n.º 4
0
 def RaiseEvent(self):
     # Raise Text event
     evt = wx.CommandEvent(wx.wxEVT_COMMAND_TEXT_UPDATED)
     evt.SetEventObject(self.nameText)
     evt.SetId(self.nameText.GetId())
     self.nameText.GetEventHandler().ProcessEvent(evt)
Exemplo n.º 5
0
 def SendClickEvent( self ) :
     checkEvent = wx.CommandEvent( wx.wxEVT_COMMAND_BUTTON_CLICKED, self.GetId() )
     checkEvent.SetEventObject( self )
     self.GetEventHandler().ProcessEvent( checkEvent )
Exemplo n.º 6
0
 def _send_change_event(self):
     """
     Sends an event EVT_COMMAND_ENTER to notify that the value has changed
     """
     changeEvent = wx.CommandEvent(wx.wxEVT_COMMAND_ENTER, self.Id)
     wx.PostEvent(self, changeEvent)
Exemplo n.º 7
0
 def SendButtonClickEvent(self, control):
     evt = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, control.GetId())
     evt.SetEventObject(control)
     control.GetEventHandler().ProcessEvent(evt)
Exemplo n.º 8
0
 def enterText(self, dropdown, text):
     event = wx.CommandEvent(wx.wxEVT_TEXT, wx.Window.NewControlId())
     event.SetString(text)
     dropdown.widget.GetTextCtrl().ProcessEvent(event)
Exemplo n.º 9
0
 def _fireButtonEvent(self):
     event = wx.CommandEvent(wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
     self.GetEventHandler().AddPendingEvent(event)
Exemplo n.º 10
0
    def InitControls(self):
        xradio = self.width / 1440.0
        yradio = self.height / 900.0

        username = wx.TextCtrl(self,
                               -1,
                               Setting.getLastLogin(),
                               style=wx.BORDER_NONE)
        username.SetPosition((int(xradio * 776), int(yradio * 404)))
        username.SetSize((int(xradio * 176), int(yradio * 28)))
        password = wx.TextCtrl(self,
                               -1,
                               '',
                               style=wx.BORDER_NONE | wx.PASSWORD)
        #if Setting.getSign().lower() == 'true' :
        #    password.SetValue(Setting.getPasswd())
        #password = wx.TextCtrl(self, -1, , style = wx.BORDER_NONE|wx.PASSWORD)
        password.SetPosition((int(xradio * 776), int(yradio * 451)))
        password.SetSize((int(xradio * 178), int(yradio * 28)))

        self.auto = wx.CheckBox(self, -1, u'自动登录')
        self.auto.SetValue(Setting.getAuto().lower() == 'true')
        self.sign = wx.CheckBox(self, -1, u'保存密码')
        self.sign.SetValue(Setting.getSign().lower() == 'true')
        self.sign.SetPosition((int(xradio * 731), int(yradio * 500)))

        self.auto.SetPosition((int(xradio * 879), int(yradio * 500)))

        #self.auto.Enable(False)

        self.Bind(wx.EVT_CHECKBOX, self.OnSign, self.sign)
        self.Bind(wx.EVT_CHECKBOX, self.OnAuto, self.auto)

        self.sign.SetValue(Setting.getSign().lower() == 'true')

        btn_login = wx.BitmapButton(self, -1, Resource.btn_login, None)
        btn_login.SetPosition((int(xradio * 880), int(yradio * 530)))
        btn_login.SetDefault()
        self.Bind(wx.EVT_BUTTON, self.OnLogin, btn_login)

        #   btn_shutdown = wx.BitmapButton(self, -1, Resource.btn_shutdown,None)
        #   btn_shutdown.SetPosition((int(xradio * 1405),
        #                         int(yradio * 865)))
        #   btn_shutdown.SetSize((int(xradio * 36), int(yradio * 36)))
        #   self.Bind(wx.EVT_BUTTON, self.OnShutdown, btn_shutdown)

        btn_shutdown = wx.Button(self, -1, u"关机", style=wx.NO_BORDER)
        btn_shutdown.SetPosition((int(xradio * 1385), int(yradio * 865)))
        btn_shutdown.SetSize((int(xradio * 60), int(yradio * 40)))
        self.Bind(wx.EVT_BUTTON, self.OnShutdown, btn_shutdown)

        if username.GetValue() == '':
            username.SetFocus()
        else:
            password.SetFocus()

        self.username = username
        self.password = password
        if Setting.getSign().lower() == 'true':
            password.SetValue(Setting.getPasswd())
            self.auto.SetValue(Setting.getAuto().lower() == 'true')
        else:
            self.auto.SetValue(False)

        # Add by wdr 20150601 start
        if Setting.getAuto().lower() != 'true':
            #print 'not auto'
            pass
        else:
            #print 'auto'
            evt = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED,
                                  btn_login.GetId())
            wx.PostEvent(self, evt)
Exemplo n.º 11
0
 def onClick(self, evt=None):
     evt = wx.CommandEvent(wx.EVT_BUTTON.typeId)
     evt.SetEventObject(self)
     wx.PostEvent(self.parent, evt)
Exemplo n.º 12
0
 def OnTooltip(self, browser, text):
     event = wx.CommandEvent()
     event.SetString(text[0])
     if self.htmlwin: self.htmlwin.on_status_message(event)
Exemplo n.º 13
0
 def OnLoadStart(self, browser, frame):
     #if self.htmlwin: self.htmlwin.loading += 1
     event = wx.CommandEvent()
     event.SetString(frame.GetUrl())
     if self.htmlwin: self.htmlwin.on_load_start(event)
     if self.htmlwin: self.htmlwin.progress_changed(0)
Exemplo n.º 14
0
 def OnTitleChange(self, browser, title):
     event = wx.CommandEvent()
     event.SetString(title)
     if self.htmlwin and not self.htmlwin.component:
         self.htmlwin.on_title_changed(event)
Exemplo n.º 15
0
class RegistryLazyTree(wx.TreeCtrl):
    def __init__(
        self,
        parent,
        id=-1,
        key = _winreg.HKEY_CURRENT_USER,
        subkey = "Software",
        valueName = None,
        pos = wx.DefaultPosition,
        size = wx.DefaultSize,
        style = wx.TR_HAS_BUTTONS,
        validator = wx.DefaultValidator,
        name="RegistryLazyTree",
        text = None
    ):
        self.text = text
        wx.TreeCtrl.__init__(
            self, parent, id, pos, size, style, validator, name
        )

        self.imageList = imageList = wx.ImageList(16, 16)
        rootIcon = imageList.Add(eg.Icons.GetInternalBitmap("root"))
        self.folderIcon = imageList.Add(eg.Icons.GetInternalBitmap("folder"))
        self.valueIcon = imageList.Add(eg.Icons.GetInternalBitmap("action"))
        self.SetImageList(imageList)
        self.SetMinSize((-1, 200))
        self.treeRoot = self.AddRoot(
            "Registry",
            image = rootIcon,
            data = wx.TreeItemData((True, None, None, None))
        )
        #Adding keys
        for item in regKeys:
            #a tupel of 4 values is assigned to every item
            #1) stores if the key has yet to be queried for subkey, when
            #   selected
            #2) _winreg.hkey constant
            #3) name of the key
            #4) value name, None if just a key, empty string for default value
            tmp = self.AppendItem(
                self.treeRoot,
                item[1],
                image = self.folderIcon,
                data =wx.TreeItemData((False, item[0], "", None))
            )
            self.SetItemHasChildren(tmp, True)
            if item[0] == key:
                self.SelectItem(tmp)

        #select old value in tree
        self.OnTreeChange(wx.CommandEvent(), key, subkey, valueName)
        self.EnsureVisible(self.GetSelection())

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeChange)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnExpandNode)

    def GetValue(self):
        data = self.GetItemData(self.GetSelection()).GetData()
        return data[1], data[2], data[3]

    def OnExpandNode(self, event):
        self.OnTreeChange(event, node = event.GetItem())

    def OnTreeChange(
        self,
        event,
        key2Select = None,
        subkey2Select = None,
        valueName2Select = None,
        node = None
    ):
        if not node:
            node = self.GetSelection()

        keyHasBeenQueried, fatherKey, \
            fatherSubkey, fatherValueName = self.GetItemData(node).GetData()
        subkey2Find = None
        newItemSelected = False

        if not keyHasBeenQueried:  #check for subkeys
            self.SetItemData(
                node,
                wx.TreeItemData(
                    (True, fatherKey, fatherSubkey, fatherValueName)
                )
            )

            #buildung tree
            try:
                regHandle = _winreg.OpenKey(fatherKey, fatherSubkey)
            except EnvironmentError, exc:
                eg.PrintError(self.text.keyOpenError + ": " + str(exc))
                return 0

            #query subkeys
            if len(fatherSubkey) == 0:
                parentSubkey = ""
            else:
                parentSubkey = fatherSubkey + "\\"

            #preparing strings to find the subkey2Select key
            if valueName2Select:
                valueName2Select = valueName2Select.lower()
            if subkey2Select:
                subkey2Select = subkey2Select.lower()
            if key2Select and subkey2Select and key2Select == fatherKey:
                length = len(fatherSubkey)
                if subkey2Select[0:length] == fatherSubkey.lower():
                    subkey2Find = subkey2Select[length:]
                    if subkey2Find.startswith("\\"):
                        subkey2Find = subkey2Find[1:]
                    subkeys = subkey2Find.split("\\", 1)
                    subkey2Find = subkeys[0]

            #building Tree
            keyNames, valueList = RegEnumKeysAndValues(regHandle.handle)

            #sorting
            keyNames.sort(lambda a, b: cmp(a[0].lower(), b[0].lower()))
            valueList.sort(lambda a, b: cmp(a[0].lower(), b[0].lower()))

            #subkeys
            for keyName, numSubKeys, numSubValues in keyNames:
                hasChildren = bool(numSubKeys + numSubValues > 0)
                data = (
                    not hasChildren,
                    fatherKey,
                    parentSubkey + keyName,
                    None
                )
                tmp = self.AppendItem(
                    node,
                    keyName,
                    image=self.folderIcon,
                    data=wx.TreeItemData(data)
                )
                if subkey2Find == keyName.lower():
                    newItemSelected = True
                    self.SelectItem(tmp)
                self.SetItemHasChildren(tmp, hasChildren)

            #values
            for valueName, valueType in valueList:
                if len(valueName) == 0:
                    enumValueName = self.text.defaultText
                else:
                    enumValueName = valueName
                data = (True, fatherKey, fatherSubkey, valueName)
                tmp = self.AppendItem(
                    node,
                    enumValueName,
                    image = self.valueIcon,
                    data = wx.TreeItemData(data)
                )
                if (
                    valueName2Select is not None and
                    valueName.lower() == valueName2Select and
                    subkey2Select == fatherSubkey.lower()
                ):
                    newItemSelected = True
                    self.SelectItem(tmp)

        if newItemSelected:
            self.OnTreeChange(
                wx.CommandEvent(),
                key2Select,
                subkey2Select,
                valueName2Select
            )
        event.Skip()
Exemplo n.º 16
0
 def Finish(self):
     evt = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, wx.ID_OK)
     wx.PostEvent(self, evt)
Exemplo n.º 17
0
    def __init__(self, parent, dataToAdd=None):
        super().__init__(parent,
                         id=wx.ID_ANY,
                         title="Implant Set Editor",
                         resizeable=True,
                         size=wx.Size(950, 500)
                         if "wxGTK" in wx.PlatformInfo else wx.Size(850, 420))

        self.block = False
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.entityEditor = ImplantSetEntityEditor(self)
        mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2)

        self.sl = wx.StaticLine(self)
        mainSizer.Add(self.sl, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        self.iview = ImplantSetEditorView(self)
        mainSizer.Add(self.iview, 1, wx.ALL | wx.EXPAND, 5)

        self.slfooter = wx.StaticLine(self)
        mainSizer.Add(self.slfooter, 0, wx.EXPAND | wx.TOP, 5)

        footerSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.stNotice = wx.StaticText(self, wx.ID_ANY, "")
        self.stNotice.Wrap(-1)
        footerSizer.Add(self.stNotice, 1, wx.BOTTOM | wx.TOP | wx.LEFT, 5)

        importExport = (("Import", wx.ART_FILE_OPEN, "from"),
                        ("Export", wx.ART_FILE_SAVE_AS, "to"))

        for name, art, direction in importExport:
            bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
            btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)

            btn.SetMinSize(btn.GetSize())
            btn.SetMaxSize(btn.GetSize())

            btn.Layout()
            setattr(self, name, btn)
            btn.Enable(True)
            btn.SetToolTip("%s implant sets %s clipboard" % (name, direction))
            footerSizer.Add(btn, 0)

        mainSizer.Add(footerSizer, 0, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(mainSizer)
        self.Layout()

        if dataToAdd:
            name, implants = dataToAdd
            newSet = self.entityEditor.DoNew(name)
            ImplantSets.getInstance().addImplants(
                newSet.ID, *[i.item.ID for i in implants])
            self.entityEditor.refreshEntityList(newSet)
            wx.PostEvent(self.entityEditor.entityChoices,
                         wx.CommandEvent(wx.wxEVT_COMMAND_CHOICE_SELECTED))
        elif not self.entityEditor.checkEntitiesExist():
            self.Close()
            return

        self.Bind(wx.EVT_CHOICE, self.entityChanged)
        self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)

        self.Import.Bind(wx.EVT_BUTTON, self.importPatterns)
        self.Export.Bind(wx.EVT_BUTTON, self.exportPatterns)

        self.SetMinSize(self.GetSize())
        self.CenterOnParent()
Exemplo n.º 18
0
 def post_event(self):
     event = wx.CommandEvent()  #@UndefinedVariable
     event.SetEventObject(self)
     event.SetEventType(wx.EVT_BUTTON.typeId)  #@UndefinedVariable
     wx.PostEvent(self, event)  #@UndefinedVariable
Exemplo n.º 19
0
 def _send_change_event(self):
     """ Create and send a change event (wxEVT_COMMAND_ENTER) """
     changeEvent = wx.CommandEvent(wx.wxEVT_COMMAND_ENTER, self.Id)
     wx.PostEvent(self, changeEvent)
Exemplo n.º 20
0
 def runAction(self, actionContext):
     dialog = actionContext.getParentWindow()
     dialog.onNo(wx.CommandEvent(0, 0))
Exemplo n.º 21
0
    def CreateOptionsPage(self):
        """ 
        Creates the :class:`~wx.lib.agw.labelbook.LabelBook` option page which holds the
        :class:`~wx.lib.agw.flatmenu.FlatMenu` styles.
        """

        options = wx.Panel(self._book, wx.ID_ANY, wx.DefaultPosition,
                           wx.Size(300, 300))

        # Create some options here
        vsizer = wx.BoxSizer(wx.VERTICAL)
        options.SetSizer(vsizer)

        #-----------------------------------------------------------
        # options page layout
        # - Menu Style: Default or 2007 (radio group)
        #
        # - Default Style Settings:     (static box)
        #     + Draw vertical gradient  (check box)
        #     + Draw border             (check box)
        #     + Drop toolbar shadow     (check box)
        #
        # - Colour Scheme                   (static box)
        #     + Menu bar background colour  (combo button)
        #-----------------------------------------------------------

        self._menuStyleID = wx.NewId()
        choices = [_("Default Style"), _("Metallic")]
        self._menuStyle = wx.RadioBox(options, self._menuStyleID,
                                      _("Menu bar style"), wx.DefaultPosition,
                                      wx.DefaultSize, choices)

        # update the selection
        theme = ArtManager.Get().GetMenuTheme()

        if theme == Style2007:
            self._menuStyle.SetSelection(1)
        else:
            self._menuStyle.SetSelection(0)

        # connect event to the control
        self._menuStyle.Bind(wx.EVT_RADIOBOX, self.OnChangeStyle)

        vsizer.Add(self._menuStyle, 0, wx.EXPAND | wx.ALL, 5)

        self._sbStyle = wx.StaticBoxSizer(
            wx.StaticBox(options, -1, _("Default style settings")),
            wx.VERTICAL)
        self._drawVertGradID = wx.NewId()
        self._verticalGradient = wx.CheckBox(options, self._drawVertGradID,
                                             _("Draw vertical gradient"))
        self._verticalGradient.Bind(wx.EVT_CHECKBOX, self.OnChangeStyle)
        self._sbStyle.Add(self._verticalGradient, 0, wx.EXPAND | wx.ALL, 3)
        self._verticalGradient.SetValue(
            ArtManager.Get().GetMBVerticalGradient())

        self._drawBorderID = wx.NewId()
        self._drawBorder = wx.CheckBox(options, self._drawBorderID,
                                       _("Draw border around menu bar"))
        self._drawBorder.Bind(wx.EVT_CHECKBOX, self.OnChangeStyle)
        self._sbStyle.Add(self._drawBorder, 0, wx.EXPAND | wx.ALL, 3)
        self._drawBorder.SetValue(ArtManager.Get().GetMenuBarBorder())

        self._shadowUnderTBID = wx.NewId()
        self._shadowUnderTB = wx.CheckBox(options, self._shadowUnderTBID,
                                          _("Toolbar float over menu bar"))
        self._shadowUnderTB.Bind(wx.EVT_CHECKBOX, self.OnChangeStyle)
        self._sbStyle.Add(self._shadowUnderTB, 0, wx.EXPAND | wx.ALL, 3)
        self._shadowUnderTB.SetValue(ArtManager.Get().GetRaiseToolbar())

        vsizer.Add(self._sbStyle, 0, wx.EXPAND | wx.ALL, 5)

        # Misc
        sb = wx.StaticBoxSizer(wx.StaticBox(options, -1, _("Colour Scheme")),
                               wx.VERTICAL)
        self._colourID = wx.NewId()

        colourChoices = ArtManager.Get().GetColourSchemes()
        colourChoices.sort()

        self._colour = wx.ComboBox(options,
                                   self._colourID,
                                   ArtManager.Get().GetMenuBarColourScheme(),
                                   choices=colourChoices,
                                   style=wx.CB_DROPDOWN | wx.CB_READONLY)
        sb.Add(self._colour, 0, wx.EXPAND)
        vsizer.Add(sb, 0, wx.EXPAND | wx.ALL, 5)
        self._colour.Bind(wx.EVT_COMBOBOX, self.OnChangeStyle)

        # update the dialog by sending all possible events to us
        event = wx.CommandEvent(wx.wxEVT_COMMAND_RADIOBOX_SELECTED,
                                self._menuStyleID)
        event.SetEventObject(self)
        event.SetInt(self._menuStyle.GetSelection())
        self._menuStyle.ProcessEvent(event)

        event.SetEventType(wx.wxEVT_COMMAND_CHECKBOX_CLICKED)
        event.SetId(self._drawVertGradID)
        event.SetInt(ArtManager.Get().GetMBVerticalGradient())
        self._verticalGradient.ProcessEvent(event)

        event.SetEventType(wx.wxEVT_COMMAND_CHECKBOX_CLICKED)
        event.SetId(self._shadowUnderTBID)
        event.SetInt(ArtManager.Get().GetRaiseToolbar())
        self._shadowUnderTB.ProcessEvent(event)

        event.SetEventType(wx.wxEVT_COMMAND_CHECKBOX_CLICKED)
        event.SetId(self._drawBorderID)
        event.SetInt(ArtManager.Get().GetMenuBarBorder())
        self._drawBorder.ProcessEvent(event)

        event.SetEventType(wx.wxEVT_COMMAND_COMBOBOX_SELECTED)
        event.SetId(self._colourID)
        self._colour.ProcessEvent(event)

        return options
Exemplo n.º 22
0
 def _emulateMenuClick(self, menuItemId):
     """
     Эмуляция события выбора пункта меню
     """
     event = wx.CommandEvent(wx.wxEVT_COMMAND_MENU_SELECTED, menuItemId)
     self.mainWindow.ProcessEvent(event)
Exemplo n.º 23
0
 def update_menu(self, menu):
     event = wx.CommandEvent(wx.EVT_MENU_OPEN.evtType[0],
                             self.frame.GetId())
     event.SetEventObject(self.frame)
     self.image.on_update_menu(event, menu)
Exemplo n.º 24
0
 def _emulateButtonClick(self, toolitemId):
     """
     Эмуляция события выбора пункта меню
     """
     event = wx.CommandEvent(wx.wxEVT_COMMAND_TOOL_CLICKED, toolitemId)
     self.mainWindow.ProcessEvent(event)
Exemplo n.º 25
0
 def _clickbutton(self, button):
     e = wx.CommandEvent(wx.EVT_BUTTON.typeId, button.Id)
     self.dialog.ProcessEvent(e)
     return
Exemplo n.º 26
0
    def Configure(
        self,
        key = None,
        subkey = None,
        valueName = None,
        action = 0,
        keyType = None,
        newValue = "",
        disableParsing=False
    ):
        text = self.text
        text2 = self.text2

        if key is None:
            key = Config.lastKeySelected
            subkey = Config.lastSubkeySelected
            valueName = Config.lastValueNameSelected
        else:
            Config.lastKeySelected = key
            Config.lastSubkeySelected = subkey
            Config.lastValueNameSelected = valueName

        panel = eg.ConfigPanel(resizable=True)
        disableParsingBox = panel.CheckBox(
            bool(disableParsing),
            text.disableParsing
        )
        #keyChooser
        regChooserCtrl = RegistryChooser(
            panel,
            -1,
            text2,
            key,
            subkey,
            valueName
        )

        def UpdateLastSelectedKeys(event):
            a, b, c = regChooserCtrl.tree.GetValue()
            Config.lastKeySelected = a
            Config.lastSubkeySelected = b
            Config.lastValueNameSelected = c
            event.Skip()

        regChooserCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, UpdateLastSelectedKeys)

        panel.sizer.Add(regChooserCtrl, 1, flag=wx.EXPAND)
        panel.sizer.Add(wx.Size(5, 5))

        #Action
        actionSizer = wx.BoxSizer(wx.HORIZONTAL)

        choices = len(text.actions)
        rb = range(0, choices)

        actionSizer.Add(
            wx.StaticText(panel, -1, text2.actionText),
            flag=wx.ALIGN_CENTER_VERTICAL
        )

        def OnRadioButton(event):
            #disables elements depending on action selection
            flag = not rb[2].GetValue()
            newValueCtrl.Enable(flag)
            typeChoice.Enable(flag)
            event.Skip()

        rb[0] = wx.RadioButton(panel, -1, text.actions[0], style = wx.RB_GROUP)
        rb[0].SetValue(action == 0)
        actionSizer.Add(rb[0], flag = wx.ALIGN_CENTER_VERTICAL)

        rb[1] = wx.RadioButton(panel, -1, text.actions[1])
        rb[1].SetValue(action == 1)
        actionSizer.Add(rb[1], flag = wx.ALIGN_CENTER_VERTICAL)

        rb[2] = wx.RadioButton(panel, -1, text.actions[2])
        rb[2].SetValue(action == 2)
        actionSizer.Add(rb[2], flag = wx.ALIGN_CENTER_VERTICAL)

        panel.sizer.Add(actionSizer)
        panel.sizer.Add(wx.Size(5, 5))

        #new Value Input
        newValueSizer = wx.FlexGridSizer(2, 4, 5, 5)
        newValueSizer.AddGrowableCol(1)

        newValueSizer.Add(
            wx.StaticText(panel, -1, text2.newValue),
            flag = wx.ALIGN_CENTER_VERTICAL
        )

        newValueCtrl = wx.TextCtrl(panel, -1, newValue, size=(200, -1))
        newValueSizer.Add(newValueCtrl, flag = wx.EXPAND)

        newValueSizer.Add(
            wx.StaticText(panel, -1, text2.typeText),
            flag = wx.ALIGN_CENTER_VERTICAL
        )

        typeChoice = wx.Choice(panel, -1)
        for i, value in enumerate(regTypes):
            typeChoice.Append(value[1])
            if value[0] == keyType:
                typeChoice.SetSelection(i)

        newValueSizer.Add(typeChoice)
        newValueSizer.Add((-1, -1))
        newValueSizer.Add(disableParsingBox)

        OnRadioButton(wx.CommandEvent())
        rb[0].Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
        rb[1].Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
        rb[2].Bind(wx.EVT_RADIOBUTTON, OnRadioButton)

        panel.sizer.Add(newValueSizer, flag = wx.EXPAND)

        while panel.Affirmed():
            key, subkey, valueName = regChooserCtrl.GetValue()

            for i, item in enumerate(rb):
                if item.GetValue():
                    action = i
                    break

            keyType = regTypes[typeChoice.GetSelection()][0]

            newValue = newValueCtrl.GetValue()

            panel.SetResult(
                key,
                subkey,
                valueName,
                action,
                keyType,
                newValue,
                disableParsingBox.GetValue()
            )
Exemplo n.º 27
0
 def _postComboBoxSelectedEvent(self, text):
     """Simulate a selection event. """
     event = wx.CommandEvent(wx.wxEVT_COMMAND_COMBOBOX_SELECTED,
                             self.GetId())
     event.SetString(text)
     self.GetEventHandler().ProcessEvent(event)
Exemplo n.º 28
0
    def Configure(
        self,
        key = None,
        subkey = None,
        valueName = None,
        action = 0,
        compareValue = ""
    ):
        text = self.text
        text2 = self.text2

        if key is None:
            key = Config.lastKeySelected
            subkey = Config.lastSubkeySelected
            valueName = Config.lastValueNameSelected
        else:
            Config.lastKeySelected = key
            Config.lastSubkeySelected = subkey
            Config.lastValueNameSelected = valueName

        panel = eg.ConfigPanel(resizable=True)

        #keyChooser
        regChooserCtrl = RegistryChooser(
            panel,
            -1,
            text2,
            key,
            subkey,
            valueName
        )

        def UpdateLastSelectedKeys(event):
            a, b, c = regChooserCtrl.tree.GetValue()
            Config.lastKeySelected = a
            Config.lastSubkeySelected = b
            Config.lastValueNameSelected = c
            event.Skip()

        regChooserCtrl.tree.Bind(
            wx.EVT_TREE_SEL_CHANGED, UpdateLastSelectedKeys
        )

        panel.sizer.Add(regChooserCtrl, 1, flag=wx.EXPAND)
        panel.sizer.Add(wx.Size(5, 5))

        choices = len(text.actions)
        rb = range(0, choices)
        sizer2 = wx.FlexGridSizer(1, choices + 2, 5, 5)
        sizer2.AddGrowableCol(4)

        sizer2.Add(
            wx.StaticText(panel, -1, text2.actionText),
            flag=wx.ALIGN_CENTER_VERTICAL
        )

        def OnRadioButton(event):
            flag = rb[2].GetValue()
            compareValueCtrl.Enable(flag)
            event.Skip()

        rb[0] = wx.RadioButton(
            panel,
            -1,
            text.actions[0],
            style = wx.RB_GROUP
        )
        rb[0].SetValue(action == 0)
        sizer2.Add(rb[0], flag = wx.ALIGN_CENTER_VERTICAL)

        rb[1] = wx.RadioButton(panel, -1, text.actions[1])
        rb[1].SetValue(action == 1)
        sizer2.Add(rb[1], flag = wx.ALIGN_CENTER_VERTICAL)

        rb[2] = wx.RadioButton(panel, -1, text.actions[2])
        rb[2].SetValue(action == 2)
        sizer2.Add(rb[2], flag = wx.ALIGN_CENTER_VERTICAL)

        compareValueCtrl = wx.TextCtrl(panel, -1, compareValue, size=(200, -1))
        sizer2.Add(compareValueCtrl, flag = wx.EXPAND)

        OnRadioButton(wx.CommandEvent())
        rb[0].Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
        rb[1].Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
        rb[2].Bind(wx.EVT_RADIOBUTTON, OnRadioButton)

        panel.sizer.Add(sizer2, flag = wx.EXPAND)

        while panel.Affirmed():
            key, subkey, valueName = regChooserCtrl.GetValue()
            compareValue = compareValueCtrl.GetValue()
            for i in range(0, 3):
                if rb[i].GetValue():
                    action = i
                    break
            panel.SetResult(key, subkey, valueName, action, compareValue)
Exemplo n.º 29
0
 def post_event(self):
     event = wx.CommandEvent()
     event.SetEventObject(self)
     event.SetEventType(wx.EVT_BUTTON.typeId)
     wx.PostEvent(self, event)
Exemplo n.º 30
0
 def OnAddressChange(self, browser, frame, url):
     event = wx.CommandEvent()
     event.SetString(url)
     if self.htmlwin: self.htmlwin.on_address_changed(event)