60 Private slot to edit the (per user) Mercurial configuration file. |
61 Private slot to edit the (per user) Mercurial configuration file. |
61 """ |
62 """ |
62 from QScintilla.MiniEditor import MiniEditor |
63 from QScintilla.MiniEditor import MiniEditor |
63 cfgFile = self.__plugin.getConfigPath() |
64 cfgFile = self.__plugin.getConfigPath() |
64 if not os.path.exists(cfgFile): |
65 if not os.path.exists(cfgFile): |
|
66 username = "" |
|
67 from .MercurialUserDataDialog import MercurialUserDataDialog |
|
68 dlg = MercurialUserDataDialog() |
|
69 if dlg.exec_() == QDialog.Accepted: |
|
70 name, email = dlg.getData() |
|
71 if name and email: |
|
72 username = "{0} <{1}>".format(name, email) |
|
73 elif name: |
|
74 username = name |
|
75 elif email: |
|
76 username = email |
65 try: |
77 try: |
66 f = open(cfgFile, "w") |
78 f = open(cfgFile, "w") |
|
79 f.write(os.linesep.join(["[ui]", "username = {0}".format(username), ""])) |
67 f.close() |
80 f.close() |
68 except (IOError, OSError): |
81 except (IOError, OSError): |
69 # ignore these |
82 # ignore these |
70 pass |
83 pass |
71 editor = MiniEditor(cfgFile, "Properties", self) |
84 editor = MiniEditor(cfgFile, "Properties", self) |