Skip to content

Commit 2260db7

Browse files
authored
PluginGenerator: fix non-symlink building and clean up plan
1 parent aa16638 commit 2260db7

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

plugindevtools/PluginDevTools/PluginGenerator.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def __init__(self):
184184
self.centralWidget.setupGitBtn.clicked.connect(self.gitRemotePath)
185185
self.centralWidget.hotkeysBtn.clicked.connect(self.genActions)
186186
self.centralWidget.doneBtn.clicked.connect(self.doneClicked)
187+
self.centralWidget.projectPathSymlinkChk.toggled.connect(self.toggleSymlink)
187188

188189
self.centralWidget.autocompleteChk.stateChanged.connect(self.autocompleteCheck)
189190

@@ -196,6 +197,18 @@ def __init__(self):
196197
self.centralWidget.setupGitBtn.setEnabled(False)
197198

198199

200+
201+
202+
def toggleSymlink(self):
203+
if self.centralWidget.projectPathBtn.isEnabled():
204+
self.centralWidget.projectPathBtn.setEnabled(False)
205+
self.centralWidget.projectPathHeaderLabel.setText('Project Path:')
206+
self.centralWidget.projectPathLabel.setText(os.path.join(self.respath,'pykrita'))
207+
else:
208+
self.centralWidget.projectPathBtn.setEnabled(True)
209+
self.centralWidget.projectPathHeaderLabel.setText('Project Path: (project path will symlink to your pykrita folder)')
210+
self.centralWidget.projectPathLabel.setText('')
211+
199212
def doneClicked(self):
200213
res = self.buildPlan()
201214

@@ -228,6 +241,7 @@ def buildActionCollection(self,data):
228241
return xml
229242

230243
def buildPlan(self):
244+
self.plan=[]
231245
projectPath = self.centralWidget.projectPathLabel.text()
232246
if projectPath == 'Select Path...' or not os.path.isdir(projectPath):
233247
return { 'error':"Invalid 'Project Path'" }
@@ -243,10 +257,12 @@ def buildPlan(self):
243257
template = self.centralWidget.templateListWidget.currentItem()
244258
if not template:
245259
return { 'error':"No template was selected" }
246-
260+
247261
projectRoot = os.path.join(projectPath,shortName)
248-
249-
self.plan.append([ lambda: os.mkdir(projectRoot), "Create Directory "+projectRoot ])
262+
if self.centralWidget.projectPathSymlinkChk.isChecked():
263+
self.plan.append([ lambda: os.mkdir(projectRoot), "Create Directory "+projectRoot ])
264+
else:
265+
projectRoot= os.path.join(self.respath,'pykrita')
250266

251267
projectDesktopFile = os.path.join(projectRoot,shortName+'.desktop')
252268
projectDesktopFileContent = '''[Desktop Entry]

0 commit comments

Comments
 (0)