Beispiel #1
0
 def update_undo_memory(self):
     mem_used = servers.get_command_server().getmemoryused()
     mem_limit = servers.get_command_server().getmemorylimit()
     
     # Format to ###.# Xb
     mem_used = format.bytes2best_str(mem_used)
     mem_limit = format.bytes2best_str(mem_limit)
     
     self.SetStatusText("Undo memory: " + mem_used + "/" + mem_limit, ID_UndoMemory)
Beispiel #2
0
    def update_undo_memory(self):
        mem_used = servers.get_command_server().getmemoryused()
        mem_limit = servers.get_command_server().getmemorylimit()

        # Format to ###.# Xb
        mem_used = format.bytes2best_str(mem_used)
        mem_limit = format.bytes2best_str(mem_limit)

        self.SetStatusText("Undo memory: " + mem_used + "/" + mem_limit,
                           ID_UndoMemory)
Beispiel #3
0
 def __set_properties(self):
     # main directories
     self.list_ctrl_dirs.InsertColumn(0, 'Directory')
     self.list_ctrl_dirs.InsertColumn(1, 'Assign')
     self.list_ctrl_dirs.InsertColumn(2, 'Path')
     fileserver = pynebula.lookup('/sys/servers/file2')
     assigns = [
         # [directory, assign, path]
         ['Home directory', 'home:', ''],
         ['User directory', 'user:'******''],
         ['Project directory', 'proj:', ''],
         ['Texture directory', 'textures:', ''],
         ['Mesh directory', 'meshes:', ''],
         ['Shader directory', 'shaders:', ''],
         ['Working copy directory', 'wc:', ''],
         ['GUI directory', 'outgui:', '']
         ]
     # fill rows
     for assign in assigns:
         # get path from assign
         assign[2] = fileserver.manglepath(assign[1])
         # fill row
         i = self.list_ctrl_dirs.InsertStringItem(1000, assign[0])
         self.list_ctrl_dirs.SetStringItem(i, 1, assign[1])
         self.list_ctrl_dirs.SetStringItem(i, 2, assign[2])
     # adjust column sizes to contents
     for i in range(3):
         self.list_ctrl_dirs.SetColumnWidth(i, wx.LIST_AUTOSIZE)
     
     # resources
     # resource type codes are taken from 
     # nResource::Type (nresource.h, line 51)
     self.list_ctrl_resources.InsertColumn(0, 'Resource')
     self.list_ctrl_resources.InsertColumn(1, 'Number', wx.LIST_FORMAT_RIGHT)
     self.list_ctrl_resources.InsertColumn(2, 'Memory', wx.LIST_FORMAT_RIGHT)
     resserver = pynebula.lookup('/sys/servers/resource')
     resources = [
         # [type id, name, number, memory]
         [1<<0, 'Bundles', '', ''],
         [1<<1, 'Meshes', '', ''],
         [1<<2, 'Textures', '', ''],
         [1<<3, 'Shaders', '', ''],
         [1<<4, 'Animations', '', ''],
         [1<<5, 'Sound resources', '', ''],
         [1<<6, 'Sound instances', '', ''],
         [1<<7, 'Fonts', '', ''],
         [1<<8, 'Others', '', ''],
         [0, 'Total', '', '']
         ]
     # fill rows
     total_nb = 0
     total_bytes = 0
     for res in resources:
         if res[1] != 'Total':
             # get number and memory from resource type and accumulate them
             num_resources = resserver.getnumresources(res[0])
             total_nb = total_nb + num_resources
             res[2] = str(num_resources)
             bytes = resserver.getresourcebytesize(res[0])
             total_bytes = total_bytes + bytes
             res[3] = format.bytes2best_str(bytes)
         else:
             # get number and memory from accumulated totals
             res[2] = str(total_nb)
             res[3] = format.bytes2best_str(total_bytes)
         # fill row
         i = self.list_ctrl_resources.InsertStringItem(1000, res[1])
         self.list_ctrl_resources.SetStringItem(i, 1, res[2])
         self.list_ctrl_resources.SetStringItem(i, 2, res[3])
     # adjust columns to largest contents or header
     for index in range(3):
         self.list_ctrl_resources.SetColumnWidth(
             index,
             wx.LIST_AUTOSIZE
             )
         size1 = self.list_ctrl_resources.GetColumnWidth(index)
         self.list_ctrl_resources.SetColumnWidth(
                 index,
                 wx.LIST_AUTOSIZE_USEHEADER
                 )
         size2 = self.list_ctrl_resources.GetColumnWidth(index)
         self.list_ctrl_resources.SetColumnWidth(
             index, 
             max(size1, size2)
             )
Beispiel #4
0
    def __set_properties(self):
        # main directories
        self.list_ctrl_dirs.InsertColumn(0, 'Directory')
        self.list_ctrl_dirs.InsertColumn(1, 'Assign')
        self.list_ctrl_dirs.InsertColumn(2, 'Path')
        fileserver = pynebula.lookup('/sys/servers/file2')
        assigns = [
            # [directory, assign, path]
            ['Home directory', 'home:', ''],
            ['User directory', 'user:'******''],
            ['Project directory', 'proj:', ''],
            ['Texture directory', 'textures:', ''],
            ['Mesh directory', 'meshes:', ''],
            ['Shader directory', 'shaders:', ''],
            ['Working copy directory', 'wc:', ''],
            ['GUI directory', 'outgui:', '']
        ]
        # fill rows
        for assign in assigns:
            # get path from assign
            assign[2] = fileserver.manglepath(assign[1])
            # fill row
            i = self.list_ctrl_dirs.InsertStringItem(1000, assign[0])
            self.list_ctrl_dirs.SetStringItem(i, 1, assign[1])
            self.list_ctrl_dirs.SetStringItem(i, 2, assign[2])
        # adjust column sizes to contents
        for i in range(3):
            self.list_ctrl_dirs.SetColumnWidth(i, wx.LIST_AUTOSIZE)

        # resources
        # resource type codes are taken from
        # nResource::Type (nresource.h, line 51)
        self.list_ctrl_resources.InsertColumn(0, 'Resource')
        self.list_ctrl_resources.InsertColumn(1, 'Number',
                                              wx.LIST_FORMAT_RIGHT)
        self.list_ctrl_resources.InsertColumn(2, 'Memory',
                                              wx.LIST_FORMAT_RIGHT)
        resserver = pynebula.lookup('/sys/servers/resource')
        resources = [
            # [type id, name, number, memory]
            [1 << 0, 'Bundles', '', ''],
            [1 << 1, 'Meshes', '', ''],
            [1 << 2, 'Textures', '', ''],
            [1 << 3, 'Shaders', '', ''],
            [1 << 4, 'Animations', '', ''],
            [1 << 5, 'Sound resources', '', ''],
            [1 << 6, 'Sound instances', '', ''],
            [1 << 7, 'Fonts', '', ''],
            [1 << 8, 'Others', '', ''],
            [0, 'Total', '', '']
        ]
        # fill rows
        total_nb = 0
        total_bytes = 0
        for res in resources:
            if res[1] != 'Total':
                # get number and memory from resource type and accumulate them
                num_resources = resserver.getnumresources(res[0])
                total_nb = total_nb + num_resources
                res[2] = str(num_resources)
                bytes = resserver.getresourcebytesize(res[0])
                total_bytes = total_bytes + bytes
                res[3] = format.bytes2best_str(bytes)
            else:
                # get number and memory from accumulated totals
                res[2] = str(total_nb)
                res[3] = format.bytes2best_str(total_bytes)
            # fill row
            i = self.list_ctrl_resources.InsertStringItem(1000, res[1])
            self.list_ctrl_resources.SetStringItem(i, 1, res[2])
            self.list_ctrl_resources.SetStringItem(i, 2, res[3])
        # adjust columns to largest contents or header
        for index in range(3):
            self.list_ctrl_resources.SetColumnWidth(index, wx.LIST_AUTOSIZE)
            size1 = self.list_ctrl_resources.GetColumnWidth(index)
            self.list_ctrl_resources.SetColumnWidth(index,
                                                    wx.LIST_AUTOSIZE_USEHEADER)
            size2 = self.list_ctrl_resources.GetColumnWidth(index)
            self.list_ctrl_resources.SetColumnWidth(index, max(size1, size2))