Example #1
0
    def drop_work(
        self,
        file_names,
    ):
        try:
            file_names = list(file_names)
            self.form.m_staticText_load_tex.SetLabel('开始')
            self.form.m_staticText_mesh_load.SetLabel('开始')

            dir_name = (filter(lambda x: not os.path.isfile(x), file_names))
            dir_name = map(lambda x: function.all_file_path(x)[1].values(),
                           dir_name)
            list(map(lambda x: file_names.extend(x), dir_name))

            file_names = (filter(lambda x: os.path.isfile(x), file_names))

            if self.full['clear_list']:
                self.info.clear()

            paths = list(
                filter(
                    lambda x: re.match(r'^UISprite\s#\d+\.png$',
                                       os.path.basename(x)) is None,
                    file_names))

            returned_tex, tex_info = tools.file_deal2(paths, self.info,
                                                      self.full['clear_list'],
                                                      self.pattern_tex, True,
                                                      '', self.names,
                                                      self.tex_type)

            returned_mesh, mesh_info = tools.file_deal2(
                paths, self.info, self.full['clear_list'], self.pattern_mesh,
                True, "-mesh", self.names, self.mesh_type)
            if returned_tex:
                self.form.m_gauge_tex_load.SetValue(100)

                self.form.m_listBox_tex.Set(self.info.for_show)
            self.form.m_staticText_load_tex.SetLabel(tex_info)
            if returned_mesh:
                self.form.m_gauge_mesh_load.SetValue(100)

                self.form.m_listBox_mesh.Set(self.info.for_show)
            self.form.m_staticText_mesh_load.SetLabel(mesh_info)

            self.info_check()

        except RuntimeError as info:
            return False, info

        else:
            return True, ''
Example #2
0
    def load_tex(self):
        self.form.m_gauge_tex_load.SetValue(0)
        if self.lock:
            address = self.default['default_tex_dir']
        else:
            address = os.getcwd()
        self.__dialog = wx.FileDialog(self.form,
                                      "打开",
                                      address,
                                      "AzurLane.png",
                                      "*.PNG",
                                      style=wx.FD_MULTIPLE | wx.FD_CHANGE_DIR
                                      | wx.FD_FILE_MUST_EXIST)

        if self.__dialog.ShowModal() == wx.ID_OK:

            self.form.m_staticText_load_tex.SetLabel("开始")
            self.form.m_gauge_tex_load.SetValue(0)
            paths = self.__dialog.GetPaths()
            returned = tools.file_deal2(paths, self.info,
                                        self.full['clear_list'],
                                        self.pattern_tex, True, '', self.names,
                                        self.tex_type)
            if returned[0]:
                self.form.m_gauge_tex_load.SetValue(100)

                self.form.m_listBox_tex.Set(self.info.for_show)
            self.form.m_staticText_load_tex.SetLabel(returned[1])
            address = paths
        else:
            address = ''
        self.info_check()

        return address
Example #3
0
    def load_tex_and_mesh(self):
        self.form.m_gauge_tex_load.SetValue(0)
        self.__dialog = wx.DirDialog(self.form,
                                     "打开",
                                     os.getcwd(),
                                     style=wx.DD_NEW_DIR_BUTTON
                                     | wx.DD_CHANGE_DIR | wx.DD_DEFAULT_STYLE
                                     | wx.DD_DIR_MUST_EXIST)

        if self.__dialog.ShowModal() == wx.ID_OK:
            paths = self.__dialog.GetPath()
            self.form.m_staticText_load_tex.SetLabel('开始')
            self.form.m_staticText_mesh_load.SetLabel('开始')

            paths = function.all_file_path(paths)[1]

            returned_tex, tex_info = tools.file_deal2(paths, self.info,
                                                      self.full['clear_list'],
                                                      self.pattern_tex, False,
                                                      '', self.names,
                                                      self.tex_type)

            returned_mesh, mesh_info = tools.file_deal2(
                paths, self.info, self.full['clear_list'], self.pattern_mesh,
                False, "-mesh", self.names, self.mesh_type)
            if returned_tex:
                self.form.m_gauge_tex_load.SetValue(100)

                self.form.m_listBox_tex.Set(self.info.for_show)
            self.form.m_staticText_load_tex.SetLabel(tex_info)
            if returned_mesh:
                self.form.m_gauge_mesh_load.SetValue(100)

                self.form.m_listBox_mesh.Set(self.info.for_show)
            self.form.m_staticText_mesh_load.SetLabel(mesh_info)

            address = self.__dialog.GetPath()
        else:
            address = 'None'

        self.info_check()

        return address
Example #4
0
    def load_mesh_fold(self):
        self.form.m_gauge_tex_load.SetValue(0)
        if self.lock:
            address = self.default['default_mesh_dir']
        else:
            address = os.getcwd()

        self.__dialog = wx.DirDialog(self.form,
                                     "打开",
                                     address,
                                     style=wx.DD_NEW_DIR_BUTTON
                                     | wx.DD_CHANGE_DIR | wx.DD_DEFAULT_STYLE
                                     | wx.DD_DIR_MUST_EXIST)

        if self.__dialog.ShowModal() == wx.ID_OK:
            paths = self.__dialog.GetPath()
            self.form.m_staticText_mesh_load.SetLabel("开始")
            self.form.m_gauge_mesh_load.SetValue(0)

            paths = function.all_file_path(paths)[1]

            returned, info = tools.file_deal2(paths, self.info,
                                              self.full['clear_list'],
                                              self.pattern_mesh, False,
                                              "-mesh", self.names,
                                              self.mesh_type)
            if returned:
                self.form.m_gauge_mesh_load.SetValue(100)
                self.form.m_staticText_mesh_load.SetLabel(info)
                self.form.m_listBox_mesh.Set(self.info.for_show)
            self.form.m_staticText_mesh_load.SetLabel(info)
            address = self.__dialog.GetPath()
        else:
            address = 'None'

        self.info_check()

        return address
Example #5
0
    def load_mesh(self):
        self.form.m_gauge_tex_load.SetValue(0)
        if self.lock:
            address = self.default['default_mesh_dir']
        else:
            address = os.getcwd()
        self.__dialog = wx.FileDialog(self.form,
                                      "打开",
                                      address,
                                      wildcard="*.OBJ",
                                      style=wx.FD_MULTIPLE | wx.FD_CHANGE_DIR
                                      | wx.FD_FILE_MUST_EXIST)

        if self.__dialog.ShowModal() == wx.ID_OK:
            self.form.m_staticText_mesh_load.SetLabel("开始")
            self.form.m_gauge_mesh_load.SetValue(0)
            paths = self.__dialog.GetPaths()

            returned = tools.file_deal2(paths, self.info,
                                        self.full['clear_list'],
                                        self.pattern_mesh, True, "-mesh",
                                        self.names, self.mesh_type)

            if returned[0]:
                self.form.m_gauge_mesh_load.SetValue(function.re_int(100))

                self.form.m_listBox_mesh.Set(self.info.for_show)
            self.form.m_staticText_mesh_load.SetLabel(returned[1])

            address = paths
        else:
            address = ''

        self.info_check()

        return address