Ejemplo n.º 1
0
 def on_import_tileset(self, message):
     file_name = QtGui.QFileDialog.getOpenFileName(
         self, filter='Tilesets (*.png)',
         directory=self.config.get(
             'tilesets_images_dir', os.path.expanduser('~')
         )
     )
     if file_name:
         self.config.set(
             'tilesets_images_dir',
             os.path.dirname(str(file_name))
         )
         self.send('config.save')
         workspace = TileSetWorkspace(
             self, str(file_name), self._queue
         )
         workspace.show()
         self._tab_widget.addTab(workspace, workspace.base_name())
         self._workspaces.append(workspace)
         self.send('tileset_editor.new_tileset', {
             'tileset': workspace.base_name()
         })
Ejemplo n.º 2
0
 def on_open_file(self, message):
     self.current_file = self.config.current_file()
     for tileset in self.current_file.get('tilesets', []):
         workspace = TileSetWorkspace(
             self, self.current_file['pathes'][tileset], self._queue
         )
         workspace.show()
         self._tab_widget.addTab(workspace, workspace.base_name())
         self._workspaces.append(workspace)
         self.send('tileset_editor.new_tileset', {
             'tileset': workspace.base_name()
         })
         self.send('tileset.update', {
             'tileset': workspace.base_name()
         })
         workspace.read_tilesets_config()
     self.send('open_maps')