当前位置: 首页>>代码示例>>Python>>正文


Python QFile.error方法代码示例

本文整理汇总了Python中PySide.QtCore.QFile.error方法的典型用法代码示例。如果您正苦于以下问题:Python QFile.error方法的具体用法?Python QFile.error怎么用?Python QFile.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtCore.QFile的用法示例。


在下文中一共展示了QFile.error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindow

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import error [as 别名]
class MainWindow(QtGui.QWidget, CommandBase):

    def update_nw_versions(self, button):
        self.get_versions_in_background()

    def __init__(self, width, height, parent=None):
        super(MainWindow, self).__init__(parent)
        CommandBase.__init__(self)
        self.output_package_json = True
        self.setWindowIcon(QtGui.QIcon(os.path.join(CWD, 'files',
                                                    'images', 'icon.png')))
        self.update_json = False

        self.setup_nw_versions()

        self.thread = None
        self.original_packagejson = {}

        self.resize(width, height)

        self.extract_error = None

        self.create_application_layout()

        self.option_settings_enabled(False)

        self.setWindowTitle("Web2Executable {}".format(__gui_version__))
        self.update_nw_versions(None)

    def setup_nw_versions(self):
        nw_version = self.get_setting('nw_version')
        try:
            f = open(os.path.join(CWD, 'files', 'nw-versions.txt'))
            for line in f:
                nw_version.values.append(line.strip())
        except IOError:
            nw_version.values.append(nw_version.default_value)

    def create_application_layout(self):
        self.main_layout = QtGui.QVBoxLayout()
        self.main_layout.setContentsMargins(10, 5, 10, 5)

        self.create_layout_widgets()

        self.addWidgets_to_main_layout()

        self.setLayout(self.main_layout)

    def create_layout_widgets(self):
        self.download_bar_widget = self.create_download_bar()
        self.app_settings_widget = self.create_application_settings()
        self.win_settings_widget = self.create_window_settings()
        self.ex_settings_widget = self.create_export_settings()
        self.dl_settings_widget = self.create_download_settings()
        self.directory_chooser_widget = self.create_directory_choose()

    def addWidgets_to_main_layout(self):
        self.main_layout.addWidget(self.directory_chooser_widget)
        self.main_layout.addWidget(self.app_settings_widget)
        self.main_layout.addWidget(self.win_settings_widget)
        self.main_layout.addWidget(self.ex_settings_widget)
        self.main_layout.addWidget(self.dl_settings_widget)
        self.main_layout.addLayout(self.download_bar_widget)

    def option_settings_enabled(self, is_enabled):
        self.ex_button.setEnabled(is_enabled)
        self.app_settings_widget.setEnabled(is_enabled)
        self.win_settings_widget.setEnabled(is_enabled)
        self.ex_settings_widget.setEnabled(is_enabled)
        self.dl_settings_widget.setEnabled(is_enabled)

    def export(self, export_button, cancel_button):
        self.get_files_to_download()
        self.try_to_download_files()

    def open_export(self, open_export_button):
        open_folder_in_explorer(self.output_dir())

    def try_to_download_files(self):
        if self.files_to_download:
            self.progress_bar.setVisible(True)
            self.cancel_button.setEnabled(True)
            self.disable_ui_while_working()

            self.download_file_with_error_handling()
        else:
            # This shouldn't happen since we disable the UI if there are no
            # options selected
            # But in the weird event that this does happen, we are prepared!
            QtGui.QMessageBox.information(self,
                                          'Export Options Empty!',
                                          ('Please choose one of '
                                           'the export options!'))

    def selected_version(self):
        return self.get_setting('nw_version').value

    def enable_ui_after_error(self):
        self.enable_ui()
        self.progress_text = ''
#.........这里部分代码省略.........
开发者ID:ebenshap,项目名称:Web2Executable,代码行数:103,代码来源:main.py

示例2: MainWindow

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import error [as 别名]

#.........这里部分代码省略.........
                key = i + 1
            action = QtGui.QAction(
                self, visible=False, triggered=self.open_recent_file, shortcut=QtGui.QKeySequence("Ctrl+{}".format(key))
            )
            self.recent_file_actions.append(action)
            self.project_menu.addAction(action)

        self.recent_separator = self.project_menu.addSeparator()

        self.update_recent_files()

        exit_action = QtGui.QAction("Exit", self.project_menu)
        exit_action.triggered.connect(QtGui.qApp.closeAllWindows)
        self.project_menu.addAction(exit_action)

        self.logger = logger

        self.gui_app = app
        self.desktop_width = app.desktop().screenGeometry().width()
        self.desktop_height = app.desktop().screenGeometry().height()

        self.options_enabled = False
        self.output_package_json = True
        self.setWindowIcon(QtGui.QIcon(get_file("files/images/icon.png")))
        self.update_json = False

        self.setup_nw_versions()

        self.thread = None
        self.original_packagejson = {}

        self.resize(width, height)

        self.extract_error = None

        self.create_application_layout()

        self.option_settings_enabled(False)

        self.setWindowTitle(u"Web2Executable {}".format(__gui_version__))
        self.update_nw_versions(None)

    def open_recent_file(self):
        action = self.sender()
        if action:
            self.load_project(action.data())

    def setup_nw_versions(self):
        nw_version = self.get_setting("nw_version")
        try:
            f = codecs.open(get_data_file_path("files/nw-versions.txt"), encoding="utf-8")
            for line in f:
                nw_version.values.append(line.strip())
            f.close()
        except IOError:
            nw_version.values.append(nw_version.default_value)

    def create_application_layout(self):
        self.main_layout = QtGui.QVBoxLayout()
        self.tab_widget = QtGui.QTabWidget()
        self.main_layout.setContentsMargins(10, 5, 10, 5)

        self.create_layout_widgets()

        self.addWidgets_to_main_layout()
开发者ID:guzuomuse,项目名称:Web2Executable,代码行数:69,代码来源:main.py


注:本文中的PySide.QtCore.QFile.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。