當前位置: 首頁>>代碼示例>>Python>>正文


Python Path.copy方法代碼示例

本文整理匯總了Python中src.tools.path.Path.copy方法的典型用法代碼示例。如果您正苦於以下問題:Python Path.copy方法的具體用法?Python Path.copy怎麽用?Python Path.copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在src.tools.path.Path的用法示例。


在下文中一共展示了Path.copy方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_index_html

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def add_index_html(self, src, title):
     Path.copy(src, EpubPath.html_path)
     filename = Path.get_filename(src)
     new_src = u'html/' + filename
     resource_id = self.opf.add_html(new_src)
     self.toc.add_item(resource_id, new_src, title)
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:9,代碼來源:epub.py

示例2: create_chapter

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def create_chapter(self, src, title):
     Path.copy(src, EpubPath.html_path)
     filename = Path.get_filename(src)
     new_src = u'html/' + filename
     resource_id = self.opf.add_title_page_html(new_src)
     self.directory.create_chapter(new_src, title)
     self.toc.create_chapter(resource_id, new_src, title)
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:10,代碼來源:epub.py

示例3: create_single_html_book

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def create_single_html_book(self, book_package):
     title = book_package.get_title()
     if not title:
         # 電子書題目為空時自動跳過
         # 否則會發生『rm -rf / 』的慘劇
         return
     Path.reset_path()
     Path.chdir(Path.result_path)
     Path.rmdir(u'./' + title)
     Path.mkdir(u'./' + title)
     Path.chdir(u'./' + title)
     page = []
     for book in book_package.book_list:
         page += book.page_list
     content = u' \r\n '.join([Match.html_body(x.content) for x in page]).replace(u'../images/', u'./images/')
     with open(TemplateConfig.content_base_uri) as html:
         content = html.read().format(title=title, body=content).replace(u'../style/', u'./')
     with open(title + u'.html', 'w') as html:
         html.write(content)
     Path.copy(Path.html_pool_path + u'/../{}/OEBPS/images'.format(title), u'./images')
     Path.copy(Path.www_css + u'/customer.css', u'./customer.css')
     Path.copy(Path.www_css + u'/markdown.css', u'./markdown.css')
     Path.copy(Path.www_css + u'/normalize.css', u'./normalize.css')
     Path.reset_path()
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:27,代碼來源:book.py

示例4: download_button_clicked

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
    def download_button_clicked(self):
        tags = str(self.custom_tags.text())

        # url_id = self.recipes.model.data(1, QtCore.Qt.UserRole)    # TODO: 獲得選中的recipes
        url_id = str(self.row_clicked(self.recipes.currentIndex()))

        if url_id == 'None':
            QtGui.QMessageBox.information(self, u"Error", u"選擇需要爬取的網站!")
            return

        readlist_content = self.plainTextEdit.toPlainText()

        if readlist_content == '':
            QtGui.QMessageBox.information(self, u"Error", u"請在文本框中輸入網址")
            return

        read_list_path = Path.read_list_path

        readList_file = open(read_list_path, 'w')
        readList_file.write(readlist_content)

        readList_file.close()

        game = EEBook(recipe_kind=url_id)

        progress_dlg = QProgressDialog(self)        # TODO: 設置大小, 區域
        progress_dlg.setWindowModality(Qt.WindowModal)
        progress_dlg.setMinimumDuration(5)
        progress_dlg.setWindowTitle(u"請等待")
        progress_dlg.setLabelText(u"製作中...請稍候")
        progress_dlg.setCancelButtonText(u"取消")
        progress_dlg.resize(350, 250)
        progress_dlg.show()
        progress_dlg.setRange(0, 20)

        for i in range(0, 15):
            progress_dlg.setValue(i)
            QThread.msleep(100)

        for i in range(15, 20):
            progress_dlg.setValue(i)
            QThread.msleep(100)
            if progress_dlg.wasCanceled():
                QtGui.QMessageBox.information(self, u"Error", u"電子書製作失敗, 請重新操作")
                return

            try:
                filename = game.begin()      # TODO: 一次隻能生成一本書
            except TypeError:
                QtGui.QMessageBox.information(self, u"Error", u"第一次使用請登錄")
                progress_dlg.close()
                return
            progress_dlg.close()

            info_filename = ','.join(filename)
            QtGui.QMessageBox.information(self, u"info", u"電子書"+str(info_filename)+u"製作成功")

            for item in filename:
                file_path = EPUBSTOR_DIR + '/' + item
                Path.copy(str(file_path+'.epub'), LIBRARY_DIR)
                file_name = os.path.basename(str(file_path))
                book_id = file_name.split('.epub')[0]

                Path.mkdir(LIBRARY_DIR + book_id)
                shutil.move(LIBRARY_DIR+book_id+'.epub', LIBRARY_DIR+book_id)

                book = Book(str(book_id))
                book.date = time.strftime(ISOTIMEFORMAT, time.localtime())
                book.tags += tags.replace(' ', '')
                book.tags += ','+str(self.now_url)
                if self.add_title_tag.isChecked():
                    book.tags += ','+str(book.title)
                insert_library(book)
            return
開發者ID:bindx,項目名稱:EE-Book,代碼行數:76,代碼來源:download.py

示例5: add_cover_image

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def add_cover_image(self, src):
     Path.copy(src, EpubPath.image_path)
     filename = Path.get_filename(src)
     new_src = u'images/' + filename
     resource_id = self.opf.add_cover_image(new_src)
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:8,代碼來源:epub.py

示例6: add_css

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def add_css(self, src):
     Path.copy(src, EpubPath.style_path)
     filename = Path.get_filename(src)
     new_src = u'style/' + filename
     resource_id = self.opf.add_css(new_src)
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:8,代碼來源:epub.py

示例7: add_duokan_ext

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def add_duokan_ext():
     Path.copy(EpubConfig.duokan_container_uri, EpubPath.meta_inf_path)
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:5,代碼來源:inf.py

示例8: add_container

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import copy [as 別名]
 def add_container():
     Path.copy(EpubConfig.container_uri, EpubPath.meta_inf_path)
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:5,代碼來源:inf.py


注:本文中的src.tools.path.Path.copy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。