Exemplo n.º 1
0
def setup():
    if not hasattr(application, 'command_line_args'):
        application.main_window = MainWindow()
        application.wx_app.SetTopWindow(application.main_window)
        application.main_window.Show()
    else:
        args = application.command_line_args
        if not os.path.exists(args.path):
            wx.MessageBox(_('The specified file or directory does not exist.'), _('Error'), wx.ICON_ERROR, parent=None)
            return
        if os.path.isdir(args.path):
            conversion_pipeline.add_paths(paths.walk_directory_tree(args.path), from_folder=True)
            if len(conversion.conversion_queue) == 0:
                wx.MessageBox(_('No supported files were found in the specified directory.'), _('Error'), wx.ICON_ERROR, parent=None)
                return
        else:
            conversion_pipeline.add_paths([args.path])

        if len(conversion.conversion_queue) == 0:
            return

        conversion.remove_drm_only = args.remove_drm_only
        if not conversion.remove_drm_only:
            conversion.output_format = conversion.OutputFormat[args.format].name
        conversion_pipeline.start()
        return
Exemplo n.º 2
0
    def onAddFolder(self, event):
        folder_dialog = wx.DirDialog(self, message=_('Please select the folder to be added'), defaultPath=application.config['working_directory'], style=wx.DD_DEFAULT_STYLE|wx.DD_DIR_MUST_EXIST)
        result = folder_dialog.ShowModal()

        if result == wx.ID_OK:
            conversion_pipeline.add_paths(paths.walk_directory_tree(folder_dialog.GetPath()), parent=self, from_folder=True)
            application.config['working_directory'] = os.path.split(folder_dialog.GetPath())[0]
            application.config.write()
            self.files_list.SetFocus()