UI/UserInterface.py

changeset 1726
5d3132740ece
parent 1613
bafe0eeb0f30
child 1754
4e2f87d03546
equal deleted inserted replaced
1725:d7a3430f7cbf 1726:5d3132740ece
2789 2789
2790 def __reportBug(self): 2790 def __reportBug(self):
2791 """ 2791 """
2792 Private slot to handle the Report Bug dialog. 2792 Private slot to handle the Report Bug dialog.
2793 """ 2793 """
2794 self.__showEmailDialog("bug") 2794 self.showEmailDialog("bug")
2795 2795
2796 def __requestFeature(self): 2796 def __requestFeature(self):
2797 """ 2797 """
2798 Private slot to handle the Feature Request dialog. 2798 Private slot to handle the Feature Request dialog.
2799 """ 2799 """
2800 self.__showEmailDialog("feature") 2800 self.showEmailDialog("feature")
2801 2801
2802 def __showEmailDialog(self, mode, attachFile=None, deleteAttachFile=False): 2802 def showEmailDialog(self, mode, attachFile=None, deleteAttachFile=False):
2803 """ 2803 """
2804 Private slot to show the email dialog in a given mode. 2804 Public slot to show the email dialog in a given mode.
2805 2805
2806 @param mode mode of the email dialog (string, "bug" or "feature") 2806 @param mode mode of the email dialog (string, "bug" or "feature")
2807 @param attachFile name of a file to attach to the email (string) 2807 @param attachFile name of a file to attach to the email (string)
2808 @param deleteAttachFile flag indicating to delete the attached file after 2808 @param deleteAttachFile flag indicating to delete the attached file after
2809 it has been sent (boolean) 2809 it has been sent (boolean)
2864 what to do with it. 2864 what to do with it.
2865 """ 2865 """
2866 if Preferences.getUI("CheckErrorLog"): 2866 if Preferences.getUI("CheckErrorLog"):
2867 logFile = os.path.join(Utilities.getConfigDir(), "eric5_error.log") 2867 logFile = os.path.join(Utilities.getConfigDir(), "eric5_error.log")
2868 if os.path.exists(logFile): 2868 if os.path.exists(logFile):
2869 dlg = E5MessageBox.E5MessageBox(E5MessageBox.Question, 2869 from .ErrorLogDialog import ErrorLogDialog
2870 self.trUtf8("Error log found"), 2870 dlg = ErrorLogDialog(logFile, self)
2871 self.trUtf8("An error log file was found. "
2872 "What should be done with it?"),
2873 modal=True, parent=self)
2874 try:
2875 f = open(logFile, "r", encoding="utf-8")
2876 txt = f.read()
2877 f.close()
2878 dlg.setDetailedText(txt)
2879 except IOError:
2880 pass
2881 emailButton = \
2882 dlg.addButton(self.trUtf8("Send Bug Email"),
2883 E5MessageBox.AcceptRole)
2884 deleteButton = \
2885 dlg.addButton(self.trUtf8("Ignore and Delete"),
2886 E5MessageBox.AcceptRole)
2887 keepButton = \
2888 dlg.addButton(self.trUtf8("Ignore but Keep"),
2889 E5MessageBox.AcceptRole)
2890 dlg.setDefaultButton(emailButton)
2891 dlg.setEscapeButton(keepButton)
2892 dlg.exec_() 2871 dlg.exec_()
2893 btn = dlg.clickedButton()
2894 if btn == emailButton:
2895 # start email dialog
2896 self.__showEmailDialog("bug",
2897 attachFile=logFile, deleteAttachFile=True)
2898 elif btn == deleteButton:
2899 # delete the error log
2900 os.remove(logFile)
2901 elif btn == keepButton:
2902 # keep the error log
2903 pass
2904 2872
2905 def __compareFiles(self): 2873 def __compareFiles(self):
2906 """ 2874 """
2907 Private slot to handle the Compare Files dialog. 2875 Private slot to handle the Compare Files dialog.
2908 """ 2876 """

eric ide

mercurial