eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8240
93b8a353c4bf
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
7 """ 7 """
8 Module implementing the Git configuration page. 8 Module implementing the Git configuration page.
9 """ 9 """
10 10
11 import os 11 import os
12 import contextlib
12 13
13 from PyQt5.QtCore import pyqtSlot 14 from PyQt5.QtCore import pyqtSlot
14 from PyQt5.QtWidgets import QDialog 15 from PyQt5.QtWidgets import QDialog
15 16
16 from Preferences.ConfigurationPages.ConfigurationPageBase import ( 17 from Preferences.ConfigurationPages.ConfigurationPageBase import (
27 """ 28 """
28 Constructor 29 Constructor
29 30
30 @param plugin reference to the plugin object 31 @param plugin reference to the plugin object
31 """ 32 """
32 super(GitPage, self).__init__() 33 super().__init__()
33 self.setupUi(self) 34 self.setupUi(self)
34 self.setObjectName("GitPage") 35 self.setObjectName("GitPage")
35 36
36 self.__plugin = plugin 37 self.__plugin = plugin
37 38
91 if dlg.exec() == QDialog.DialogCode.Accepted: 92 if dlg.exec() == QDialog.DialogCode.Accepted:
92 firstName, lastName, email = dlg.getData() 93 firstName, lastName, email = dlg.getData()
93 else: 94 else:
94 firstName, lastName, email = ( 95 firstName, lastName, email = (
95 "Firstname", "Lastname", "email_address") 96 "Firstname", "Lastname", "email_address")
96 try: 97 with contextlib.suppress(OSError), open(cfgFile, "w") as f:
97 with open(cfgFile, "w") as f: 98 f.write("[user]\n")
98 f.write("[user]\n") 99 f.write(" name = {0} {1}\n".format(firstName, lastName))
99 f.write(" name = {0} {1}\n".format(firstName, lastName)) 100 f.write(" email = {0}\n".format(email))
100 f.write(" email = {0}\n".format(email))
101 except OSError:
102 # ignore these
103 pass
104 editor = MiniEditor(cfgFile, "Properties", self) 101 editor = MiniEditor(cfgFile, "Properties", self)
105 editor.show() 102 editor.show()

eric ide

mercurial