Beispiel #1
0
    def GetNormalCheckImageList():
        """Returns the icons for a "normal" checkbox

        Returns:
        A two element ImageList of a an empty and checked checkbox

        """
        imageList = wx.ImageList(14, 12)
        imageList.Add(IconManager.getBitmap('checkEmpty'))
        imageList.Add(IconManager.getBitmap('checkGreen'))
        return imageList
Beispiel #2
0
    def GetAddSubImageList():
        """ Creates a wxImageList for a plus/minus/empty check box and returns it.

        Returns:
        A wxImageList of plus/minus/empty check bitmaps

        """
        imageList = wx.ImageList(14, 12)
        imageList.Add(IconManager.getBitmap('checkEmpty'))
        imageList.Add(IconManager.getBitmap('checkPlus'))
        imageList.Add(IconManager.getBitmap('checkMinus'))
        return imageList
Beispiel #3
0
    def DrawButtonIcon(button, filename, from_resource):
        """Draws a bitmap on a button from an embedded resource or file

        Arguments:
        button -- A wxBitmapButton instance to draw on
        filename -- Either the filename if a game icon or the embedded resource name
        from_resource -- Bool flag to denote if bitmap loads from embedded resource

        Returns:
        None

        """

        if from_resource:
            bitmap = IconManager.getBitmap(filename)
        else:
            pilImage = RTPCache.Icon(filename)
            if pilImage is not None:
                image = wx.Image(pilImage.size[0], pilImage.size[1])
                image.SetData(pilImage.convert("RGB").tostring())
                image.SetAlpha(pilImage.convert("RGBA").tostring()[3::4])
                bitmap = wx.BitmapFromImage(image)
            else:
                bitmap = wx.Bitmap(1, 1)
        button.SetBitmapLabel(bitmap)
Beispiel #4
0
    def AddTools(self):

        # get bitmaps
        newbmp = IconManager.getBitmap("new")
        openbmp = IconManager.getBitmap("open")
        savebmp = IconManager.getBitmap("save")
        undobmp = IconManager.getBitmap("undo")
        redobmp = IconManager.getBitmap("redo")
        copybmp = IconManager.getBitmap("copy")
        cutbmp = IconManager.getBitmap("cut")
        pastebmp = IconManager.getBitmap("paste")
        # set up ids
        self.newid = wx.NewId()
        self.openid = wx.NewId()
        self.saveid = wx.NewId()
        self.redoid = wx.NewId()
        self.undoid = wx.NewId()
        self.copyid = wx.NewId()
        self.cutid = wx.NewId()
        self.pasteid = wx.NewId()
        # add the tools
        self.AddSimpleTool(self.newid, "New", newbmp,
                           "Create a new project")
        self.AddSimpleTool(self.openid, "Open", openbmp,
                           "Open a ARC Project")
        self.AddSimpleTool(self.saveid, "Save", savebmp,
                           "Save the current Project")
        self.AddSeparator()
        self.AddSimpleTool(self.undoid, "Undo", undobmp,
                           "Undo last action")
        self.AddSimpleTool(self.redoid, "Redo", redobmp,
                           "Redo last action")
        self.AddSeparator()
        self.AddSimpleTool(self.cutid, "Cut", cutbmp,
                           "Cut selection and copy to the clipboard")
        self.AddSimpleTool(self.copyid, "Copy", copybmp,
                           "Copy selection to the clipboard")
        self.AddSimpleTool(self.pasteid, "Paste", pastebmp,
                           "Paste data from the clipboard")
    def generateInfo(self, info, info_obj=None):
        '''
        generates a AuiPaneInfo object from the info string and data dict.
        if an existing AuiPaneInfo object is provided
        it is extended with the information in the info string and data dict.
        commands that contradict previous setting in the provided AuiPaneInfo
        object overwrite old settings.

        @param info: a dict of keys where each key corresponds
            to a method that could be called on the AuiPaneInfo object

        @param info_obj: a AuiPaneInfo object to be extended
        '''

        if info_obj is None:
            info_obj = aui.AuiPaneInfo()
            info_obj.DefaultPane()

        for key in info:

            if key in self.info_specials:

                if key == "IconARCM":
                    icon = IconManager.getBitmap(info["IconARCM"])
                    info_obj.Icon(icon)
                else:
                    raise KeyError(
                        "'%s' is a invalid _arc_panel_info key" % key
                    )
            elif key in self.info_methods:
                method = getattr(info_obj, self.info_methods[key])
                if info[key] is None:
                    method()
                else:
                    method(info[key])
            else:
                raise KeyError(
                    "'%s' is a invalid _arc_panel_info key" % key
                )

        return info_obj
Beispiel #6
0
    def __init__(
            self,
            parent,
            id=wx.ID_ANY,
            title="",
            pos=wx.DefaultPosition,
            size=MinEditorSize,
            style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER):

        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        # center the frame
        self.CenterOnScreen()
        self.SetMinSize(MinEditorSize)

        self.main_title = title

        # set the frame icon
        self.SetIcon(IconManager.getIcon("welder"))

        self._mgr = AuiManager_DCP_ARC()
        if wx.Platform == "__WXMSW__":
            try:
                import pywin32
                del pywin32
                self._mgr.SetArtProvider(aui.ModernDockArt(self))
            except ImportError:
                pass
        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)
        self.layout_mgr = None

        # add a status bar and menubar
        self.CreateStatusBar()
        self.CreateMenuBar()
        self.CallLayout()

        self.SetMinSize(MinEditorSize)

        # kernel.System.bind_event('RefreshProject', )

        self.Bind(wx.EVT_UPDATE_UI, self.updateUI)
        self.Bind(wx.EVT_CLOSE, self.OnClose, self)

        # Bind AUI events
        self.Bind(aui.EVT_AUI_PANE_FLOATING, self.OnPaneFloating)
        self.Bind(aui.EVT_AUI_PANE_FLOATED, self.OnPaneFloated)
        self.Bind(aui.EVT_AUI_PANE_DOCKING, self.OnPaneDocking)
        self.Bind(aui.EVT_AUI_PANE_DOCKED, self.OnPaneDocked)
        self.Bind(aui.EVT_AUI_PANE_CLOSE, self.OnPaneClosed)

        # start The autosave Time
        self.AutoSaveTimer = wx.Timer(self)
        # TODO: fix autosave
        #save_intervel = kernel.Config.getint("Main", "Autosave")
        #self.Bind(wx.EVT_TIMER, self.ProcessAutoSave, self.AutoSaveTimer)
        #self.AutoSaveTimer.Start(save_intervel * 60000, False)

        # show the window
        wx.GetApp().SetTopWindow(self)
        self.Show(True)
        kernel.System.fire_event("EditorReady")
Beispiel #7
0
    def AddTools(self):
        # get bitmaps
        mapeditbmp = IconManager.getBitmap("mapedit")
        actorsbmp = IconManager.getBitmap("actors")
        classesbmp = IconManager.getBitmap("classes")
        skillsbmp = IconManager.getBitmap("skills")
        itemsbmp = IconManager.getBitmap("items")
        weaponsbmp = IconManager.getBitmap("weapons")
        armorsbmp = IconManager.getBitmap("armors")
        enemiesbmp = IconManager.getBitmap("enemies")
        troopsbmp = IconManager.getBitmap("troops")
        statesbmp = IconManager.getBitmap("states")
        animationsbmp = IconManager.getBitmap("animations")
        tilesetsbmp = IconManager.getBitmap("tilesets")
        commoneventsbmp = IconManager.getBitmap("commonEvents")
        systembmp = IconManager.getBitmap("system")
        scriptbmp = IconManager.getBitmap("script")

        # set up ids
        self.mapeditid = wx.NewId()
        self.actorsid = wx.NewId()
        self.classesid = wx.NewId()
        self.skillsid = wx.NewId()
        self.itemsid = wx.NewId()
        self.weaponsid = wx.NewId()
        self.armorsid = wx.NewId()
        self.enemiesid = wx.NewId()
        self.troopsid = wx.NewId()
        self.statesid = wx.NewId()
        self.animationsid = wx.NewId()
        self.tilesetsid = wx.NewId()
        self.commoneventsid = wx.NewId()
        self.systemid = wx.NewId()
        self.scriptid = wx.NewId()

        # add the tools
        self.AddSimpleTool(
            self.mapeditid,
            "Map Editor",
            mapeditbmp,
            "Open the Map Editor"
        )
        self.AddSeparator()
        self.AddSimpleTool(
            self.actorsid,
            "Actors",
            actorsbmp,
            "Open the Actors Panel"
        )
        self.AddSimpleTool(
            self.classesid,
            "Classes",
            classesbmp,
            "Open the Classes Panel"
        )
        self.AddSimpleTool(
            self.skillsid,
            "Skills",
            skillsbmp,
            "Open the Skills Panel"
        )
        self.AddSimpleTool(
            self.statesid,
            "States",
            statesbmp,
            "Open the States Panel"
        )
        self.AddSeparator()
        self.AddSimpleTool(
            self.itemsid,
            "Items",
            itemsbmp,
            "Open the Items Panel"
        )
        self.AddSimpleTool(
            self.weaponsid,
            "Weapons",
            weaponsbmp,
            "Open the Weapons Panel"
        )
        self.AddSimpleTool(
            self.armorsid,
            "Armors",
            armorsbmp,
            "Open the Armors Panel"
        )
        self.AddSeparator()
        self.AddSimpleTool(
            self.enemiesid,
            "Enemies",
            enemiesbmp,
            "Open the Enemies Panel"
        )
        self.AddSimpleTool(
            self.troopsid,
            "Troops",
            troopsbmp,
            "Open the Troops Panel"
        )
        self.AddSeparator()
        self.AddSimpleTool(
            self.animationsid,
            "Animations",
            animationsbmp,
            "Open the Animations Panel"
        )
        self.AddSimpleTool(
            self.tilesetsid,
            "Tilesets",
            tilesetsbmp,
            "Open the Tilesets Panel"
        )

        self.AddSeparator()
        self.AddSimpleTool(
            self.commoneventsid,
            "Common Events",
            commoneventsbmp,
            "Open the Common Events Panel"
        )
        self.AddSimpleTool(
            self.systemid,
            "System",
            systembmp,
            "Open the System Panel"
        )
        self.AddSimpleTool(
            self.scriptid,
            "Scripts",
            scriptbmp,
            "Open the Scripts Panel"
        )