Exemple #1
0
    def Configure(self):
        self.foundId = None
        style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        eg.TaskletDialog.__init__(self, None, -1, title="Export", style=style)
        staticText = wx.StaticText(self, -1, text.mesg)

        filterClasses = (eg.FolderItem, )  #eg.MacroItem)

        def filterFunc(obj):
            return isinstance(obj, filterClasses)

        tree = eg.TreeItemBrowseCtrl(self, filterFunc)  #, multiSelect=True)
        #tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        tree.UnselectAll()

        buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL), True)

        mainSizer = eg.VBoxSizer(
            (staticText, 0, wx.EXPAND | wx.ALL, 5),
            (tree, 1, wx.EXPAND),
            (buttonRow.sizer, 0, wx.EXPAND),
        )
        self.SetSizerAndFit(mainSizer)
        self.SetAutoLayout(True)
        #mainSizer.Fit(self)
        #self.SetMinSize(self.GetSize())
        self.SetSize((450, 400))
        while self.Affirmed():
            items = tree.GetSelections()
            GetPyData = tree.GetPyData
            self.SetResult([GetPyData(item) for item in items])
Exemple #2
0
 def __init__(self,
              parent=None,
              title=eg.APP_NAME,
              source="",
              icon=None,
              basePath=None,
              style=wx.OK):
     eg.Dialog.__init__(self,
                        parent,
                        -1,
                        title,
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
     if icon:
         self.SetIcon(icon)
     htmlCtrl = eg.HtmlWindow(self, -1, style=wx.SUNKEN_BORDER)
     htmlCtrl.SetBorders(2)
     htmlCtrl.SetBasePath(basePath)
     htmlCtrl.SetPage(source)
     buttonIds = []
     if style & wx.OK:
         buttonIds.append(wx.ID_OK)
     if style & wx.CANCEL:
         buttonIds.append(wx.ID_CANCEL)
     self.buttonRow = eg.ButtonRow(self, buttonIds, True, True)
     mainSizer = eg.VBoxSizer(
         (htmlCtrl, 1, wx.EXPAND | wx.ALL, 5),
         (self.buttonRow.sizer, 0, wx.EXPAND),
     )
     self.SetSizerAndFit(mainSizer)
     if Config.position is not None:
         self.SetPosition(Config.position)
     self.SetSize(Config.size)
 def __init__(self):
     self.result = None
     wx.Dialog.__init__(self, eg.document.frame)
     staticText = wx.StaticText(self, -1,
                                "Please enter your master password:"******"", style=wx.TE_PASSWORD)
     self.buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL))
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(staticText, 0, wx.EXPAND | wx.ALL, 5)
     sizer.Add(self.passwordCtrl, 0, wx.EXPAND | wx.ALL, 5)
     sizer.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
     sizer.Add(self.buttonRow.sizer, 0, wx.ALIGN_CENTER)
     self.SetSizerAndFit(sizer)
Exemple #4
0
    def __init__(
        self,
        parent=None,
        title=eg.APP_NAME,
        basePath=None,
        pluginData=None,
        message="",
    ):
        Dialog.__init__(
            self,
            None,  #eg.document.frame,
            -1,
            title,
            size=(400, 300),
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        )
        self.text = TEMPLATE.format(**pluginData)
        headerCtrl = eg.HtmlWindow(self, style=wx.html.HW_SCROLLBAR_NEVER)
        headerCtrl.SetBorders(2)
        headerCtrl.SetBasePath(basePath)
        headerCtrl.SetPage(self.text)
        self.headerCtrl = headerCtrl
        #height = headerCtrl.GetInternalRepresentation().GetHeight()
        #headerCtrl.SetMinSize((-1, height + 4))
        #headerCtrl.Layout()
        descriptionCtrl = eg.HtmlWindow(self)
        descriptionCtrl.SetBorders(2)
        descriptionCtrl.SetBasePath(basePath)
        descriptionCtrl.SetPage(pluginData['description'])
        questionCtrl = self.StaticText(message)
        self.buttonRow = eg.ButtonRow(
            self, (wx.ID_OK, wx.ID_CANCEL), True, True
        )
        mainSizer = eg.VBoxSizer(
            (headerCtrl, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5),
            (wx.StaticLine(self), 0, wx.EXPAND, 0),
            (descriptionCtrl, 1, wx.EXPAND | wx.ALL, 5),
            (wx.StaticLine(self), 0, wx.EXPAND, 0),
            (questionCtrl, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5),
            (self.buttonRow.sizer, 0, wx.EXPAND),
        )
        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        mainSizer.Fit(self)
        mainSizer.Layout()
        self.Layout()
        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSize((400, 500))
        self.SetMinSize(self.GetSize())
        self.Center()
Exemple #5
0
 def Configure(self, prompt=None, initialValue=""):
     if prompt is None:
         prompt = PROMPT
     eg.TaskletDialog.__init__(
         self, None, -1, PROMPT, style=wx.RESIZE_BORDER | wx.CAPTION
     )
     textCtrl = self.TextCtrl(initialValue, size=(300, -1))
     buttonRow = eg.ButtonRow(self, [wx.ID_OK])
     mainSizer = eg.VBoxSizer(
         (self.StaticText(prompt), 0, wx.EXPAND | wx.ALL, 5),
         (textCtrl, 0, wx.EXPAND | wx.ALL, 5),
         ((5, 5), 1, wx.EXPAND),
         (wx.StaticLine(self), 0, wx.EXPAND),
         (buttonRow.sizer, 0, wx.EXPAND),
     )
     self.SetSizerAndFit(mainSizer)
     self.SetMinSize(self.GetSize())
     while self.Affirmed():
         self.SetResult(textCtrl.GetValue())
    def Configure(
        self,
        title,
        text,
        searchItem,
        resultClasses,
        filterClasses=(eg.FolderItem, eg.MacroItem),
        parent=None,
    ):
        self.resultData = searchItem
        self.resultClasses = resultClasses
        self.foundId = None
        style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        eg.TaskletDialog.__init__(self, parent, -1, title=title, style=style)
        staticText = wx.StaticText(self, -1, text)
        staticText.Wrap(430)

        def filterFunc(obj):
            return isinstance(obj, filterClasses)

        tree = eg.TreeItemBrowseCtrl(self, filterFunc, selectItem=searchItem)
        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        self.treeCtrl = tree

        self.buttonRow = eg.ButtonRow(self, (wx.ID_CANCEL, wx.ID_OK), True)
        mainSizer = eg.VBoxSizer(
            (staticText, 0, wx.EXPAND | wx.ALL, 5),
            (tree, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5),
            (self.buttonRow.sizer, 0, wx.EXPAND),
        )

        self.SetSizerAndFit(mainSizer)
        self.SetSize((450, 400))

        if not searchItem:
            self.buttonRow.okButton.Enable(False)
        while self.Affirmed():
            self.SetResult(self.resultData)
Exemple #7
0
    def __init__(self, resizable=True, showLine=True):
        self.result = None
        self.showLine = showLine
        self.resizable = resizable
        addTestButton = False
        treeItem = self.treeItem
        name = treeItem.GetTypeName()
        firstParagraph, self.description = SplitFirstParagraph(
            treeItem.GetDescription())
        size = (450, 300)
        if isinstance(treeItem, eg.PluginItem):
            title = eg.text.General.settingsPluginCaption
        elif isinstance(treeItem, eg.EventItem):
            title = eg.text.General.settingsEventCaption
            size = (450, 150)
        else:
            title = eg.text.General.settingsActionCaption
            addTestButton = True

        dialogStyle = wx.CAPTION | wx.CLOSE_BOX | wx.SYSTEM_MENU
        if resizable:
            dialogStyle |= wx.RESIZE_BORDER | wx.MAXIMIZE_BOX
        eg.TaskletDialog.__init__(self,
                                  eg.document.frame,
                                  -1,
                                  title,
                                  style=dialogStyle)

        self.notebook = wx.Notebook(self)

        self.buttonRow = eg.ButtonRow(self,
                                      (wx.ID_OK, wx.ID_CANCEL, wx.ID_APPLY),
                                      resizable)
        testButton = None
        if addTestButton:
            testButton = wx.Button(self, -1, eg.text.General.test)
            self.buttonRow.Add(testButton)
            testButton.Bind(wx.EVT_BUTTON, self.OnTestButton)

        self.buttonRow.testButton = testButton

        self.Bind(wx.EVT_CLOSE, self.OnCancel)
        self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.headerBox = eg.HeaderBox(
            self, name, firstParagraph, treeItem.icon,
            treeItem.url if hasattr(treeItem, "url") else None)
        mainSizer.SetMinSize(size)
        mainSizer.AddMany((
            (self.headerBox, 0, wx.EXPAND, 0),
            (wx.StaticLine(self), 0, wx.EXPAND | wx.ALIGN_CENTER, 0),
            (self.notebook, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 5),
        ))
        self.mainSizer = mainSizer

        def ShowHelp(dummyEvent):
            self.treeItem.ShowHelp(self)

        wx.EVT_MENU(self, wx.ID_HELP, ShowHelp)

        self.SetAcceleratorTable(
            wx.AcceleratorTable([
                (wx.ACCEL_NORMAL, wx.WXK_F1, wx.ID_HELP),
            ]))
Exemple #8
0
    def Configure(self, parent, checkMultiLoad=True, title=None):
        if title is None:
            title = Text.title
        self.checkMultiLoad = checkMultiLoad
        if self.__class__.instance:
            self.__class__.instance.Raise()
            return
        self.__class__.instance = self

        self.resultData = None

        eg.TaskletDialog.__init__(self,
                                  parent,
                                  -1,
                                  title,
                                  style=wx.DEFAULT_DIALOG_STYLE
                                  | wx.RESIZE_BORDER)

        splitterWindow = wx.SplitterWindow(
            self,
            style=(wx.SP_LIVE_UPDATE | wx.CLIP_CHILDREN
                   | wx.NO_FULL_REPAINT_ON_RESIZE))

        self.treeCtrl = treeCtrl = wx.TreeCtrl(
            splitterWindow,
            style=(wx.TR_SINGLE | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT
                   | wx.TR_LINES_AT_ROOT))

        treeCtrl.SetMinSize((170, 200))

        imageList = wx.ImageList(16, 16)
        imageList.Add(eg.Icons.PLUGIN_ICON.GetBitmap())
        imageList.Add(eg.Icons.FOLDER_ICON.GetBitmap())
        treeCtrl.SetImageList(imageList)

        root = treeCtrl.AddRoot("")
        typeIds = {
            KIND_TAGS[0]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[0] + "Plugins"),
                                1),
            KIND_TAGS[1]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[1] + "Plugins"),
                                1),
            KIND_TAGS[2]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[2] + "Plugins"),
                                1),
            KIND_TAGS[3]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[3] + "Plugins"),
                                1),
        }
        self.typeIds = typeIds
        itemToSelect = typeIds[KIND_TAGS[0]]

        for info in eg.pluginManager.GetPluginInfoList():
            if info.kind in ("hidden", "core"):
                continue
            if info.icon and info.icon != eg.Icons.PLUGIN_ICON:
                idx = imageList.Add(
                    eg.Icons.PluginSubIcon(info.icon).GetBitmap())
            else:
                idx = 0

            treeId = treeCtrl.AppendItem(typeIds[info.kind], info.name, idx)
            if not info.valid:
                treeCtrl.SetItemTextColour(treeId, eg.colour.pluginError)
            treeCtrl.SetPyData(treeId, info)
            if info.path == Config.lastSelection:
                itemToSelect = treeId

        for kind, treeId in typeIds.iteritems():
            if kind in Config.collapsed:
                treeCtrl.Collapse(treeId)
            else:
                treeCtrl.Expand(treeId)

        treeCtrl.ScrollTo(itemToSelect)

        def OnCmdExport(dummyEvent=None):
            info = self.treeCtrl.GetPyData(self.treeCtrl.GetSelection())
            if info:
                eg.PluginInstall.Export(info)

        menu = wx.Menu()
        menuId = wx.NewId()
        menu.Append(menuId, eg.text.MainFrame.Menu.Export)
        self.Bind(wx.EVT_MENU, OnCmdExport, id=menuId)
        self.contextMenu = menu
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClick)

        rightPanel = wx.Panel(splitterWindow)
        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        subSizer = wx.FlexGridSizer(2, 2)
        self.authorLabel = wx.StaticText(rightPanel, label=Text.author)
        subSizer.Add(self.authorLabel)
        self.authorText = wx.StaticText(rightPanel)
        subSizer.Add(self.authorText, 0, wx.EXPAND | wx.LEFT, 5)
        self.versionLabel = wx.StaticText(rightPanel, label=Text.version)
        subSizer.Add(self.versionLabel)
        self.versionText = wx.StaticText(rightPanel)
        subSizer.Add(self.versionText, 0, wx.EXPAND | wx.LEFT, 5)
        rightSizer.Add(subSizer, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionBox))

        self.descrBox = eg.HtmlWindow(rightPanel)
        staticBoxSizer.Add(self.descrBox, 1, wx.EXPAND)

        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND | wx.LEFT, 5)

        splitterWindow.SplitVertically(self.treeCtrl, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.SetSashGravity(0.0)
        splitterWindow.UpdateSize()

        self.buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL), True)
        self.okButton = self.buttonRow.okButton
        self.okButton.Enable(False)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        #minSize = mainSizer.GetMinSize()
        #self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        if Config.position:
            self.SetPosition(Config.position)
        treeCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        treeCtrl.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
        treeCtrl.SelectItem(itemToSelect)

        # -------- This code is for setting the use GUID instead of XmlIdLink ---------
        self.click_count = 0

        def on_left_down(evt):
            x, y = evt.GetPosition()
            width, height = self.GetClientSize()

            start_x = width - 20
            stary_y = 0

            stop_x = start_x + 20
            stop_y = stary_y + 20

            if stop_x > x > start_x and stop_y > y > stary_y:
                if not self.click_count:
                    self.CaptureMouse()

            start_x = 0
            stary_y = height - 20

            stop_x = start_x + 20
            stop_y = stary_y + 20

            if stop_x > x > start_x and stop_y > y > stary_y:
                if self.click_count:
                    self.CaptureMouse()

            evt.Skip()

        def on_left_up(evt):
            if self.HasCapture():

                self.ReleaseMouse()
                self.click_count += 1

                if self.click_count == 2:
                    self.click_count = 0
                    dialog = eg.MessageDialog(
                        parent=None,
                        message=
                        ('Warning: This process cannot be undone so make\n'
                         '                  a backup copy of your save file now.\n\n'
                         'This process will modify and save all EventGhost Data!!\n'
                         'Enable using GUID\'s?\n\n'),
                        style=wx.YES_NO | wx.STAY_ON_TOP)
                    if dialog.ShowModal() == wx.ID_YES:
                        eg.useTreeItemGUID = True
                        eg.document.SetIsDirty(True)
                        eg.document.Save()
                        eg.config.Save()

                    dialog.Destroy()

            evt.Skip()

        if eg.useTreeItemGUID is False:
            self.Bind(wx.EVT_LEFT_DOWN, on_left_down)
            self.Bind(wx.EVT_LEFT_UP, on_left_up)

# -----------------------------------------------------------------------------

        while self.Affirmed():
            if self.CheckMultiload():
                self.SetResult(self.resultData)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
        Config.collapsed = set(kind for kind, treeId in typeIds.iteritems()
                               if not treeCtrl.IsExpanded(treeId))
        self.__class__.instance = None
Exemple #9
0
    def Configure(self, parent=None):
        if OptionsDialog.instance:
            OptionsDialog.instance.Raise()
            return
        OptionsDialog.instance = self

        text = Text
        config = eg.config
        self.useFixedFont = config.useFixedFont

        eg.TaskletDialog.__init__(
            self,
            parent=parent,
            title=text.Title,
        )

        languageNames = eg.Translation.languageNames
        languageList = ["en_EN"]
        for item in os.listdir(eg.languagesDir):
            name, ext = os.path.splitext(item)
            if ext == ".py" and name in languageNames:
                languageList.append(name)
        languageList.sort()
        languageNameList = [languageNames[x] for x in languageList]
        notebook = wx.Notebook(self, -1)
        page1 = eg.Panel(notebook)
        notebook.AddPage(page1, text.Tab1)

        # page 1 controls
        startWithWindowsCtrl = page1.CheckBox(
            exists(join((eg.folderPath.Startup or ""), eg.APP_NAME + ".lnk")),
            text.StartWithWindows)
        if eg.folderPath.Startup is None:
            startWithWindowsCtrl.Enable(False)

        checkUpdateCtrl = page1.CheckBox(config.checkUpdate, text.CheckUpdate)
        checkPreReleaseCtrl = page1.CheckBox(config.checkPreRelease,
                                             text.CheckPreRelease)
        checkPreReleaseCtrl.Enable(config.checkUpdate)

        def OnCheckUpdateCheckBox(event):
            checkPreReleaseCtrl.Enable(event.IsChecked())

        checkUpdateCtrl.Bind(wx.EVT_CHECKBOX, OnCheckUpdateCheckBox)

        confirmDeleteCtrl = page1.CheckBox(config.confirmDelete,
                                           text.confirmDelete)

        showTrayIconCtrl = page1.CheckBox(config.showTrayIcon,
                                          text.showTrayIcon)

        hideOnCloseCtrl = page1.CheckBox(config.hideOnClose, text.HideOnClose)

        memoryLimitCtrl = page1.CheckBox(config.limitMemory, text.limitMemory1)
        memoryLimitSpinCtrl = page1.SpinIntCtrl(config.limitMemorySize,
                                                min=4,
                                                max=999)

        def OnMemoryLimitCheckBox(dummyEvent):
            memoryLimitSpinCtrl.Enable(memoryLimitCtrl.IsChecked())

        memoryLimitCtrl.Bind(wx.EVT_CHECKBOX, OnMemoryLimitCheckBox)
        OnMemoryLimitCheckBox(None)

        refreshEnvCtrl = page1.CheckBox(config.refreshEnv, text.refreshEnv)

        propResizeCtrl = page1.CheckBox(config.propResize, text.propResize)

        useFixedFontCtrl = page1.CheckBox(config.useFixedFont,
                                          text.UseFixedFont)

        def OnFixedFontBox(evt):
            self.UpdateFont(evt.IsChecked())

        useFixedFontCtrl.Bind(wx.EVT_CHECKBOX, OnFixedFontBox)

        datestampCtrl = page1.TextCtrl(config.datestamp)
        datestampCtrl.SetToolTipString(text.DatestampHelp)
        datestampLabel = page1.StaticText(text.Datestamp)
        datestampLabel.SetToolTipString(text.DatestampHelp)
        datestampSzr = wx.BoxSizer(wx.HORIZONTAL)
        datestampSzr.AddMany(
            ((datestampLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
             (datestampCtrl, 1, wx.EXPAND)))

        def OnDatestampKillFocus(_):
            dt_fmt = datestampCtrl.GetValue()
            try:
                strftime(dt_fmt, localtime())
            except ValueError:
                wx.MessageBox("Invalid format string!", "Error")
                datestampCtrl.SetBackgroundColour("pink")
                datestampCtrl.Refresh()
                wx.CallAfter(datestampCtrl.SetFocus)
            else:
                datestampCtrl.SetBackgroundColour(
                    wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
                datestampCtrl.Refresh()

        datestampCtrl.Bind(wx.EVT_KILL_FOCUS, OnDatestampKillFocus)

        languageChoice = BitmapComboBox(page1, style=wx.CB_READONLY)
        for name, code in zip(languageNameList, languageList):
            filename = os.path.join(eg.imagesDir, "flags", "%s.png" % code)
            if os.path.exists(filename):
                image = wx.Image(filename)
                image.Resize((16, 16), (0, 3))
                bmp = image.ConvertToBitmap()
                languageChoice.Append(name, bmp)
            else:
                languageChoice.Append(name)
        languageChoice.SetSelection(languageList.index(config.language))
        languageChoice.SetMinSize((150, -1))

        buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL))

        # construction of the layout with sizers

        flags = wx.ALIGN_CENTER_VERTICAL
        memoryLimitSizer = eg.HBoxSizer(
            (memoryLimitCtrl, 0, flags),
            (memoryLimitSpinCtrl, 0, flags),
            (page1.StaticText(text.limitMemory2), 0, flags | wx.LEFT, 2),
        )

        startGroupSizer = wx.GridSizer(cols=1, vgap=2, hgap=2)
        startGroupSizer.AddMany((
            (startWithWindowsCtrl, 0, flags),
            (checkUpdateCtrl, 0, flags),
            (checkPreReleaseCtrl, 0, flags | wx.LEFT, INDENT_WIDTH),
            (confirmDeleteCtrl, 0, flags),
            (showTrayIconCtrl, 0, flags),
            (hideOnCloseCtrl, 0, flags),
            (memoryLimitSizer, 0, flags),
            (refreshEnvCtrl, 0, flags),
            (propResizeCtrl, 0, flags),
            (useFixedFontCtrl, 0, flags),
            (datestampSzr, 0, flags),
        ))

        langGroupSizer = page1.VStaticBoxSizer(
            text.LanguageGroup,
            (languageChoice, 0, wx.LEFT | wx.RIGHT, INDENT_WIDTH),
        )

        page1Sizer = eg.VBoxSizer(
            ((15, 7), 1),
            (startGroupSizer, 0, wx.EXPAND | wx.ALL, 5),
            ((15, 7), 1),
            (langGroupSizer, 0, wx.EXPAND | wx.ALL, 5),
        )
        page1.SetSizer(page1Sizer)
        page1.SetAutoLayout(True)

        sizer = eg.VBoxSizer(
            (notebook, 1, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5),
            (buttonRow.sizer, 0, wx.EXPAND),
        )
        self.SetSizerAndFit(sizer)
        self.SetMinSize(self.GetSize())
        notebook.ChangeSelection(0)

        oldLanguage = config.language

        while self.Affirmed():
            config.checkUpdate = checkUpdateCtrl.GetValue()
            config.checkPreRelease = checkPreReleaseCtrl.GetValue()
            config.confirmDelete = confirmDeleteCtrl.GetValue()
            config.showTrayIcon = showTrayIconCtrl.GetValue()
            config.hideOnClose = hideOnCloseCtrl.GetValue()
            config.limitMemory = bool(memoryLimitCtrl.GetValue())
            config.limitMemorySize = memoryLimitSpinCtrl.GetValue()
            config.refreshEnv = refreshEnvCtrl.GetValue()
            config.propResize = propResizeCtrl.GetValue()
            config.useFixedFont = useFixedFontCtrl.GetValue()
            config.datestamp = datestampCtrl.GetValue()
            config.language = languageList[languageChoice.GetSelection()]
            config.Save()
            self.SetResult()

        eg.Utils.UpdateStartupShortcut(startWithWindowsCtrl.GetValue())

        if config.showTrayIcon:
            eg.taskBarIcon.Show()
        else:
            eg.taskBarIcon.Hide()

        if eg.mainFrame:
            eg.mainFrame.SetWindowStyleFlag()
            eg.mainFrame.logCtrl.SetDTLogging()

        if config.language != oldLanguage:
            wx.CallAfter(self.ShowLanguageWarning)

        OptionsDialog.instance = None
Exemple #10
0
    def Configure(self, parent):
        self.resultData = None
        self.lastSelectedTreeItem = None
        eg.TaskletDialog.__init__(self,
                                  parent,
                                  -1,
                                  Text.title,
                                  style=(wx.DEFAULT_DIALOG_STYLE
                                         | wx.RESIZE_BORDER | wx.THICK_FRAME))
        splitterWindow = wx.SplitterWindow(
            self,
            -1,
            style=(wx.SP_LIVE_UPDATE | wx.CLIP_CHILDREN
                   | wx.NO_FULL_REPAINT_ON_RESIZE))

        style = wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT
        tree = wx.TreeCtrl(splitterWindow, -1, style=style)
        tree.SetMinSize((100, 100))
        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivated)
        tree.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnCollapsed)
        tree.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnExpanded)
        self.tree = tree

        rightPanel = wx.Panel(splitterWindow)
        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)
        rightPanel.SetAutoLayout(True)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionLabel), wx.VERTICAL)
        self.docText = eg.HtmlWindow(rightPanel)
        self.docText.SetBorders(2)

        self.buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL), True)

        staticBoxSizer.Add(self.docText, 1, wx.EXPAND)
        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND, 5)

        splitterWindow.SplitVertically(self.tree, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.UpdateSize()

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        minSize = mainSizer.GetMinSize()
        self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        self.FillTree()
        if Config.position is not None:
            self.SetPosition(Config.position)
        while self.Affirmed():
            self.SetResult(self.resultData)

        item = self.tree.GetSelection()
        self.__class__.lastSelectedDataItem = self.tree.GetPyData(item)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
Exemple #11
0
    def Configure(self, parent):
        global gLastSelected
        self.resultData = None
        super(AddEventDialog, self).__init__(
            parent=parent, id=wx.ID_ANY, title=Text.title,
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        )
        splitterWindow = wx.SplitterWindow(
            self,
            -1,
            style=(
                wx.SP_LIVE_UPDATE |
                wx.CLIP_CHILDREN |
                wx.NO_FULL_REPAINT_ON_RESIZE
            )
        )

        leftPanel = wx.Panel(splitterWindow)
        self.tree = tree = wx.TreeCtrl(leftPanel, -1,
                           style=wx.TR_DEFAULT_STYLE |
                                 wx.TR_HIDE_ROOT |
                                 wx.TR_FULL_ROW_HIGHLIGHT
                           )
        tree.SetMinSize((100, 100))
        tree.SetImageList(eg.Icons.gImageList)

        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivated)
        tree.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnCollapsed)
        tree.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnExpanded)
        tree.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnStartDrag)
        tree.Bind(wx.EVT_SET_FOCUS, self.OnFocusTree)

        self.userEvent = wx.TextCtrl(leftPanel, wx.ID_ANY,
                                     style=wx.TE_PROCESS_ENTER)
        self.userEvent.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
        self.userEvent.Bind(wx.EVT_SET_FOCUS, self.OnFocusUserEvent)

        leftSizer =  wx.BoxSizer(wx.VERTICAL)
        leftSizer.Add(tree, 1, wx.EXPAND)
        leftSizer.Add(self.userEvent, 0, wx.EXPAND)
        leftPanel.SetSizer(leftSizer)

        rightPanel = self.rightPanel = wx.Panel(splitterWindow)
        rightSizer = self.rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)
        rightPanel.SetAutoLayout(True)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionLabel),
            wx.VERTICAL
        )
        self.docText = eg.HtmlWindow(rightPanel)
        self.docText.SetBorders(2)

        staticBoxSizer.Add(self.docText, 1, wx.EXPAND)
        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND, 5)

        splitterWindow.SplitVertically(leftPanel, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.UpdateSize()

        self.buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL), True)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        minSize = mainSizer.GetMinSize()
        self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        if Config.position is not None:
            self.SetPosition(Config.position)
        self.ReloadTree()
        while self.Affirmed():
            self.SetResult(self.resultData)
        item = tree.GetSelection()
        gLastSelected = tree.GetPyData(item)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
Exemple #12
0
    def Configure(self, parent, checkMultiLoad=True, title=None):
        if title is None:
            title = Text.title
        self.checkMultiLoad = checkMultiLoad
        if self.__class__.instance:
            self.__class__.instance.Raise()
            return
        self.__class__.instance = self

        self.resultData = None

        eg.TaskletDialog.__init__(self,
                                  parent,
                                  -1,
                                  title,
                                  style=wx.DEFAULT_DIALOG_STYLE
                                  | wx.RESIZE_BORDER)

        splitterWindow = wx.SplitterWindow(
            self,
            style=(wx.SP_LIVE_UPDATE | wx.CLIP_CHILDREN
                   | wx.NO_FULL_REPAINT_ON_RESIZE))

        self.treeCtrl = treeCtrl = wx.TreeCtrl(
            splitterWindow,
            style=(wx.TR_SINGLE | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT
                   | wx.TR_LINES_AT_ROOT))

        treeCtrl.SetMinSize((170, 200))

        imageList = wx.ImageList(16, 16)
        imageList.Add(eg.Icons.PLUGIN_ICON.GetBitmap())
        imageList.Add(eg.Icons.FOLDER_ICON.GetBitmap())
        treeCtrl.SetImageList(imageList)

        root = treeCtrl.AddRoot("")
        typeIds = {
            KIND_TAGS[0]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[0] + "Plugins"),
                                1),
            KIND_TAGS[1]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[1] + "Plugins"),
                                1),
            KIND_TAGS[2]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[2] + "Plugins"),
                                1),
            KIND_TAGS[3]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[3] + "Plugins"),
                                1),
        }
        self.typeIds = typeIds
        itemToSelect = typeIds[KIND_TAGS[0]]

        for info in eg.pluginManager.GetPluginInfoList():
            if info.kind in ("hidden", "core"):
                continue
            if info.icon and info.icon != eg.Icons.PLUGIN_ICON:
                idx = imageList.Add(
                    eg.Icons.PluginSubIcon(info.icon).GetBitmap())
            else:
                idx = 0

            treeId = treeCtrl.AppendItem(typeIds[info.kind], info.name, idx)
            if not info.valid:
                treeCtrl.SetItemTextColour(treeId, eg.colour.pluginError)
            treeCtrl.SetPyData(treeId, info)
            if info.path == Config.lastSelection:
                itemToSelect = treeId

        for kind, treeId in typeIds.iteritems():
            if kind in Config.collapsed:
                treeCtrl.Collapse(treeId)
            else:
                treeCtrl.Expand(treeId)

        treeCtrl.ScrollTo(itemToSelect)

        def OnCmdExport(dummyEvent=None):
            info = self.treeCtrl.GetPyData(self.treeCtrl.GetSelection())
            if info:
                eg.PluginInstall.Export(info)

        menu = wx.Menu()
        menuId = wx.NewId()
        menu.Append(menuId, eg.text.MainFrame.Menu.Export)
        self.Bind(wx.EVT_MENU, OnCmdExport, id=menuId)
        self.contextMenu = menu
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClick)

        rightPanel = wx.Panel(splitterWindow)
        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        subSizer = wx.FlexGridSizer(2, 2)
        self.authorLabel = wx.StaticText(rightPanel, label=Text.author)
        subSizer.Add(self.authorLabel)
        self.authorText = wx.StaticText(rightPanel)
        subSizer.Add(self.authorText, 0, wx.EXPAND | wx.LEFT, 5)
        self.versionLabel = wx.StaticText(rightPanel, label=Text.version)
        subSizer.Add(self.versionLabel)
        self.versionText = wx.StaticText(rightPanel)
        subSizer.Add(self.versionText, 0, wx.EXPAND | wx.LEFT, 5)
        rightSizer.Add(subSizer, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionBox))

        self.descrBox = eg.HtmlWindow(rightPanel)
        staticBoxSizer.Add(self.descrBox, 1, wx.EXPAND)

        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND | wx.LEFT, 5)

        splitterWindow.SplitVertically(self.treeCtrl, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.SetSashGravity(0.0)
        splitterWindow.UpdateSize()

        self.buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL), True)
        self.okButton = self.buttonRow.okButton
        self.okButton.Enable(False)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        #minSize = mainSizer.GetMinSize()
        #self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        if Config.position:
            self.SetPosition(Config.position)
        treeCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        treeCtrl.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
        treeCtrl.SelectItem(itemToSelect)

        while self.Affirmed():
            if self.CheckMultiload():
                self.SetResult(self.resultData)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
        Config.collapsed = set(kind for kind, treeId in typeIds.iteritems()
                               if not treeCtrl.IsExpanded(treeId))
        self.__class__.instance = None