MCPcopy
hub / github.com/persepolisdm/persepolis / openFile

Method openFile

persepolis/scripts/mainwindow.py:2822–2860  ·  view source on GitHub ↗
(self, menu=None)

Source from the content-addressed store, hash-verified

2820
2821 # this method executes(opens) download file if download's progress was finished
2822 def openFile(self, menu=None):
2823 # find user's selected row
2824 selected_row_return = self.selectedRow()
2825
2826 if selected_row_return is not None:
2827 # find gid
2828 gid = self.download_table.item(
2829 selected_row_return, 8).text()
2830
2831 # find status
2832 download_status = self.download_table.item(
2833 selected_row_return, 1).text()
2834
2835 if download_status == 'complete':
2836
2837 # check if this link is related to video finder
2838 # don't open download folder, if download progress for video and audio aren't completed yet.
2839 video_finder_dictionary = self.persepolis_db.searchGidInVideoFinderTable(gid)
2840
2841 if video_finder_dictionary:
2842
2843 notifySend(QCoreApplication.translate("mainwindow_src_ui_tr", "Download is in progress by video finder!"),
2844 QCoreApplication.translate("mainwindow_src_ui_tr", "be patient!"),
2845 10000, 'warning', parent=self)
2846
2847 return
2848
2849 # find download path
2850 dictionary = self.persepolis_db.searchGidInAddLinkTable(gid)
2851 file_path = dictionary['download_path']
2852
2853 if os.path.isfile(file_path):
2854 # open file
2855 osCommands.xdgOpen(file_path)
2856
2857 else:
2858 # show error message , if file was deleted or moved
2859 notifySend(str(file_path), QCoreApplication.translate("mainwindow_src_ui_tr", 'Not Found'), 5000,
2860 'warning', parent=self)
2861
2862 # this method is called when multiple items is selected by user!
2863 def selectDownloads(self):

Callers

nothing calls this directly

Calls 4

selectedRowMethod · 0.95
notifySendFunction · 0.90

Tested by

no test coverage detected