예제 #1
0
    def _create_list(self):        
        self._list_panel = scrolled.ScrolledPanel(self.main_panel, -1,
                                                  style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER, name="ListPanel")
        
        self._list = ExplorerList(self._list_panel, self)

        tb = xrcListToolbar(self._list_panel)
        tb.list = self._list
        tbsize = tb.GetToolBitmapSize()
        tb.SetToolNormalBitmap(tb.sort_by_type.GetId(), get_bitmap('icons/class.png', tbsize, self.project))
        tb.SetToolNormalBitmap(tb.sort_by_time.GetId(), get_bitmap('icons/time.png', tbsize, self.project))
        tb.SetToolNormalBitmap(tb.sort_by_name.GetId(), get_bitmap('icons/name.png', tbsize, self.project))
        tb.SetToolNormalBitmap(tb.list_icon.GetId(), get_bitmap('icons/icon_view.png', tbsize, self.project))

        if self._list.list_mode == LIST_MODE_ICON:
            tb.ToggleTool(tb.list_icon.GetId(), True)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(tb, 0, wx.EXPAND)
        sizer.Add(self._list, 1, wx.EXPAND)
        self._list_panel.SetSizer(sizer)
        
        self._list_panel.SetAutoLayout(1)
        self._list_panel.SetupScrolling()
        self._list_panel.SetInitialSize()
예제 #2
0
    def create_toolbar(self):
        toolbar = wx.ToolBar(self, -1, style=wx.BORDER_SIMPLE)
        toolbar.SetToolBitmapSize(wx.Size(32, 32))
        tool_size = toolbar.GetToolBitmapSize()
        size = (tool_size.width, tool_size.height)

        def wrap(func):
            def f(x):
                _ = x
                return func()
            return f

        def wrap_check(func):
            def f(evt):
                evt.Enable(func())
            return f

        for action in self.grid_actions:
            if not action.icon:
                continue

            label = ('%s(%s)' % (action.label, action.hot_key_tr)) if action.hot_key_tr else action.label
            if action.is_check_type:
                tool = toolbar.AddCheckTool(wx.NewId(), get_bitmap(action.icon, size, self.editor_context.project),
                                            shortHelp=label)
            else:
                tool = toolbar.AddTool(wx.NewId(), get_bitmap(action.icon, size, self.editor_context.project),
                                       shortHelpString=label)
            toolbar.Bind(wx.EVT_TOOL, wrap(action.callback), id=tool.GetId())
            if action.check_enable:
                toolbar.Bind(wx.EVT_UPDATE_UI, wrap_check(action.check_enable), id=tool.GetId())

        toolbar.Realize()
        return toolbar
예제 #3
0
    def _initialized_toolbar(self):
        project = self.project
        tbsize = self.tool_bar.GetToolBitmapSize()
        size = (tbsize.width, tbsize.height)
        self.tool_bar.SetToolNormalBitmap(self.tool_open.GetId(), get_bitmap('icons/open.png', size, project))
        self.tool_bar.SetToolNormalBitmap(self.tool_setting.GetId(), get_bitmap('icons/setting.png', size, project))
        # self.tool_bar.SetToolNormalBitmap(self.tool_repair.GetId(), get_bitmap('icons/repair.png', size, project))
        self.tool_bar.SetToolNormalBitmap(self.tool_export.GetId(), get_bitmap('icons/export.png', size, project))

        # self.tool_bar.SetToolNormalBitmap(self.tool_create_folder.GetId(), get_bitmap(ICON_FOLDER, size, project))
        # self.tool_bar.SetToolNormalBitmap(self.tool_create_filter.GetId(), get_bitmap(ICON_FILTER, size, project))

        self.Bind(wx.EVT_SIZE, self._on_size_changed)
예제 #4
0
    def create_toolbar(self):
        toolbar = wx.ToolBar(self, -1, style=wx.BORDER_SIMPLE)
        toolbar.SetToolBitmapSize(wx.Size(32, 32))
        tool_size = toolbar.GetToolBitmapSize()
        size = (tool_size.width, tool_size.height)

        def wrap(func):
            def f(x):
                _ = x
                return func()

            return f

        def wrap_check(func):
            def f(evt):
                evt.Enable(func())

            return f

        for action in self.grid_actions:
            if not action.icon:
                continue

            label = ('%s(%s)' % (action.label, action.hot_key_tr)
                     ) if action.hot_key_tr else action.label
            if action.is_check_type:
                tool = toolbar.AddCheckTool(wx.NewId(),
                                            get_bitmap(
                                                action.icon, size,
                                                self.editor_context.project),
                                            shortHelp=label)
            else:
                tool = toolbar.AddTool(wx.NewId(),
                                       get_bitmap(action.icon, size,
                                                  self.editor_context.project),
                                       shortHelpString=label)
            toolbar.Bind(wx.EVT_TOOL, wrap(action.callback), id=tool.GetId())
            if action.check_enable:
                toolbar.Bind(wx.EVT_UPDATE_UI,
                             wrap_check(action.check_enable),
                             id=tool.GetId())

        toolbar.Realize()
        return toolbar
예제 #5
0
    def _initialized_toolbar(self):
        project = self.project
        tbsize = self.tool_bar.GetToolBitmapSize()
        size = (tbsize.width, tbsize.height)
        self.tool_bar.SetToolNormalBitmap(
            self.tool_open.GetId(), get_bitmap('icons/open.png', size,
                                               project))
        self.tool_bar.SetToolNormalBitmap(
            self.tool_setting.GetId(),
            get_bitmap('icons/setting.png', size, project))
        # self.tool_bar.SetToolNormalBitmap(self.tool_repair.GetId(), get_bitmap('icons/repair.png', size, project))
        self.tool_bar.SetToolNormalBitmap(
            self.tool_export.GetId(),
            get_bitmap('icons/export.png', size, project))

        # self.tool_bar.SetToolNormalBitmap(self.tool_create_folder.GetId(), get_bitmap(ICON_FOLDER, size, project))
        # self.tool_bar.SetToolNormalBitmap(self.tool_create_filter.GetId(), get_bitmap(ICON_FILTER, size, project))

        self.Bind(wx.EVT_SIZE, self._on_size_changed)
예제 #6
0
    def _create_list(self):
        self._list_panel = scrolled.ScrolledPanel(self.main_panel,
                                                  -1,
                                                  style=wx.TAB_TRAVERSAL
                                                  | wx.SUNKEN_BORDER,
                                                  name="ListPanel")

        self._list = ExplorerList(self._list_panel, self)

        tb = xrcListToolbar(self._list_panel)
        tb.list = self._list
        tbsize = tb.GetToolBitmapSize()
        tb.SetToolNormalBitmap(
            tb.sort_by_type.GetId(),
            get_bitmap('icons/class.png', tbsize, self.project))
        tb.SetToolNormalBitmap(
            tb.sort_by_time.GetId(),
            get_bitmap('icons/time.png', tbsize, self.project))
        tb.SetToolNormalBitmap(
            tb.sort_by_name.GetId(),
            get_bitmap('icons/name.png', tbsize, self.project))
        tb.SetToolNormalBitmap(
            tb.list_icon.GetId(),
            get_bitmap('icons/icon_view.png', tbsize, self.project))

        if self._list.list_mode == LIST_MODE_ICON:
            tb.ToggleTool(tb.list_icon.GetId(), True)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(tb, 0, wx.EXPAND)
        sizer.Add(self._list, 1, wx.EXPAND)
        self._list_panel.SetSizer(sizer)

        self._list_panel.SetAutoLayout(1)
        self._list_panel.SetupScrolling()
        self._list_panel.SetInitialSize()
예제 #7
0
    def __init__(self, parent, project=None):
        self._project = None
        # [EditorFrame, ...]
        self._editor_frames = []

        # {EditorFrame: wxid}
        self._editor_to_menuid = {}

        # [fs_nodes, ...]
        self._path_history_pos = 0
        self._path_history = []

        # tool ids
        self._create_obj_tool_ids = []

        super(ExplorerFrame, self).__init__(parent)

        # icon
        icon = wx.EmptyIcon()
        icon_name = 'icons/setting.png' if (
            project and project.is_type_editor) else 'icons/table.png'
        icon.CopyFromBitmap(get_bitmap(icon_name, (64, 64), project))
        self.SetIcon(icon)

        # Replace tool icons
        self._initialized_toolbar()

        # XRCed can't assign variable for wxMenu correctly
        self.menu_windows = self.menu_close_all.GetMenu()
        self.menu_new = self.menu_new_dummy.GetMenu()
        self.menu_new.Remove(self.menu_new.FindItemByPosition(0).GetId())

        self.menu_plugins = self.menu_plugin_dummy.GetMenu()
        self.menu_plugins.Remove(
            self.menu_plugins.FindItemByPosition(0).GetId())

        self.SetMinSize((640, 480))
        self._create_tree()
        self._create_list()
        # self._create_status_view()
        # self._create_log_view()
        self._layout()

        self.Bind(wx.EVT_CHAR_HOOK, self._on_char_hook)

        if project:
            self.update_project(project)
예제 #8
0
    def __init__(self, parent, project=None):
        self._project = None            
        # [EditorFrame, ...]
        self._editor_frames = []   
        
        # {EditorFrame: wxid}  
        self._editor_to_menuid = {}
        
        # [fs_nodes, ...]
        self._path_history_pos = 0      
        self._path_history = []    
        
        # tool ids
        self._create_obj_tool_ids = [] 
             
        super(ExplorerFrame, self).__init__(parent)

        # icon
        icon = wx.EmptyIcon()
        icon_name = 'icons/setting.png' if (project and project.is_type_editor) else 'icons/table.png'
        icon.CopyFromBitmap(get_bitmap(icon_name, (64, 64), project))
        self.SetIcon(icon)
        
        # Replace tool icons
        self._initialized_toolbar()

        # XRCed can't assign variable for wxMenu correctly        
        self.menu_windows = self.menu_close_all.GetMenu()
        self.menu_new = self.menu_new_dummy.GetMenu()
        self.menu_new.Remove(self.menu_new.FindItemByPosition(0).GetId())
        
        self.menu_plugins = self.menu_plugin_dummy.GetMenu()
        self.menu_plugins.Remove(self.menu_plugins.FindItemByPosition(0).GetId())
        
        self.SetMinSize((640, 480))        
        self._create_tree()
        self._create_list()
        # self._create_status_view()
        # self._create_log_view()
        self._layout()
        
        self.Bind(wx.EVT_CHAR_HOOK, self._on_char_hook)
          
        if project:
            self.update_project(project)