summaryrefslogtreecommitdiffstats
path: root/awlsim/gui/mainwindow.py
blob: d432d624d01d589874744b0d3bce83e62a1896b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# -*- coding: utf-8 -*-
#
# AWL simulator - GUI main window
#
# Copyright 2012-2016 Michael Buesch <m@bues.ch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *

import sys
import os

from awlsim.gui.util import *
from awlsim.gui.editwidget import *
from awlsim.gui.projectwidget import *
from awlsim.gui.cpuwidget import *
from awlsim.gui.guiconfig import *
from awlsim.gui.cpuconfig import *
from awlsim.gui.linkconfig import *
from awlsim.gui.hwmodconfig import *
from awlsim.gui.icons import *


class MainWidget(QWidget):
	# Signal: Project loaded
	projectLoaded = Signal(Project)
	# Signal: Dirty-status changed
	dirtyChanged = Signal(bool)
	# Signal: CPU run state changed
	runStateChanged = Signal(RunState)
	# Signal: Source text focus changed
	textFocusChanged = Signal(bool)
	# Signal: Selected project resource changed
	selResourceChanged = Signal(int)
	# Signal: UndoAvailable state changed
	undoAvailableChanged = Signal(bool)
	# Signal: RedoAvailable state changed
	redoAvailableChanged = Signal(bool)
	# Signal: CopyAvailable state changed
	copyAvailableChanged = Signal(bool)

	def __init__(self, parent=None):
		QWidget.__init__(self, parent)
		self.setLayout(QGridLayout(self))

		self.simClient = GuiAwlSimClient()

		self.splitter = QSplitter(Qt.Horizontal)
		self.layout().addWidget(self.splitter, 0, 0)

		self.projectWidget = ProjectWidget(self)
		self.splitter.addWidget(self.projectWidget)

		self.cpuWidget = CpuWidget(self, self)
		self.splitter.addWidget(self.cpuWidget)

		self.filename = None
		self.dirty = False

		self.projectWidget.codeChanged.connect(self.__somethingChanged)
		self.projectWidget.symTabChanged.connect(self.__somethingChanged)
		self.projectWidget.libTableChanged.connect(self.__somethingChanged)
		self.projectWidget.visibleLinesChanged.connect(self.cpuWidget.updateVisibleLineRange)
		self.projectWidget.textFocusChanged.connect(self.textFocusChanged)
		self.projectWidget.selResourceChanged.connect(self.selResourceChanged)
		self.projectWidget.undoAvailableChanged.connect(self.undoAvailableChanged)
		self.projectWidget.redoAvailableChanged.connect(self.redoAvailableChanged)
		self.projectWidget.copyAvailableChanged.connect(self.copyAvailableChanged)
		self.cpuWidget.runStateChanged.connect(self.runStateChanged)
		self.cpuWidget.onlineDiagChanged.connect(self.projectWidget.handleOnlineDiagChange)
		self.cpuWidget.haveInsnDump.connect(self.projectWidget.handleInsnDump)
		self.cpuWidget.haveIdentsMsg.connect(self.projectWidget.handleIdentsMsg)
		self.cpuWidget.configChanged.connect(self.__somethingChanged)
		self.runStateChanged.connect(self.projectWidget.updateRunState)
		self.dirtyChanged.connect(self.cpuWidget.handleDirtyChange)

	def isDirty(self):
		return self.dirty

	def setDirty(self, dirty, force=False):
		if dirty != self.dirty or force:
			self.dirty = dirty
			self.dirtyChanged.emit(self.dirty)

	def __somethingChanged(self):
		self.setDirty(True)

	def getFilename(self):
		return self.filename

	def getSimClient(self):
		return self.simClient

	def getCpuWidget(self):
		return self.cpuWidget

	def getProject(self):
		return self.projectWidget.getProject()

	def newFile(self, filename=None):
		if isWinStandalone:
			executableName = "awlsim-gui.exe"
		else:
			executableName = sys.executable
		executable = findExecutable(executableName)
		if not executable:
			QMessageBox.critical(self,
				"Failed to find '%s'" % executableName,
				"Could not spawn a new instance.\n"
				"Failed to find '%s'" % executableName)
			return
		if isWinStandalone:
			argv = [ executable, ]
		else:
			argv = [ executable, "-m", "awlsim.gui.startup", ]
		if filename:
			argv.append(filename)
		PopenWrapper(argv, env = os.environ)

	def loadFile(self, filename):
		if self.dirty:
			res = QMessageBox.question(self,
				"Unsaved project",
				"The current project is modified and contains unsaved changes.\n "
				"Do you want to:\n"
				"- Save the project, close it and open the new project\n"
				"- Open the new project in a new instance or\n"
				"- Discard the changes and open the new project\n"
				"- Cancel the operation",
				QMessageBox.Save | QMessageBox.Discard |\
				QMessageBox.Open | QMessageBox.Cancel,
				QMessageBox.Open)
			if res == QMessageBox.Save:
				if not self.save():
					return
			elif res == QMessageBox.Discard:
				pass
			elif res == QMessageBox.Open:
				self.newFile(filename)
				return
			elif res == QMessageBox.Cancel:
				return
			else:
				assert(0)
		self.cpuWidget.goOffline()
		try:
			res = self.projectWidget.loadProjectFile(filename)
			if not res:
				return False
		except AwlSimError as e:
			QMessageBox.critical(self,
				"Failed to load project file", str(e))
			return False
		self.filename = filename
		self.setDirty(dirty = not bool(self.getProject().getProjectFile()),
			      force = True)
		self.projectLoaded.emit(self.getProject())
		return True

	def load(self):
		if isPyQt and isQt4:
			getOpenFileName = QFileDialog.getOpenFileNameAndFilter
		else:
			getOpenFileName = QFileDialog.getOpenFileName
		fn, fil = getOpenFileName(self,
			"Open project", "",
			"Awlsim project or AWL/STL source (*.awlpro *.awl);;"
			"Awlsim project (*.awlpro);;"
			"AWL source (*.awl);;"
			"All files (*)")
		if not fn:
			return
		self.loadFile(fn)

	def saveFile(self, filename):
		try:
			res = self.projectWidget.saveProjectFile(filename)
			if res == 0: # Failure
				return False
			elif res < 0: # Force save-as
				return self.save(newFile=True)
		except AwlSimError as e:
			QMessageBox.critical(self,
				"Failed to write project file", str(e))
			return False
		self.filename = filename
		self.setDirty(dirty = False, force = True)
		return True

	def save(self, newFile=False):
		if newFile or not self.filename:
			if isPyQt and isQt4:
				getSaveFileName = QFileDialog.getSaveFileNameAndFilter
			else:
				getSaveFileName = QFileDialog.getSaveFileName
			fn, fil = getSaveFileName(self,
				"Awlsim project save as", "",
				"Awlsim project (*.awlpro)",
				"*.awlpro")
			if not fn:
				return
			if not fn.endswith(".awlpro"):
				fn += ".awlpro"
			return self.saveFile(fn)
		else:
			return self.saveFile(self.filename)

	def guiConfig(self):
		dlg = GuiConfigDialog(self.getProject(), self)
		dlg.settingsChanged.connect(self.__somethingChanged)
		if dlg.exec_() == dlg.Accepted:
			self.projectWidget.setSettings(self.getProject().getGuiSettings())
		dlg.deleteLater()

	def linkConfig(self):
		dlg = LinkConfigDialog(self.getProject(), self)
		dlg.settingsChanged.connect(self.__somethingChanged)
		dlg.exec_()
		dlg.deleteLater()

	def cpuConfig(self):
		dlg = CpuConfigDialog(self.getProject(), self)
		dlg.settingsChanged.connect(self.__somethingChanged)
		dlg.exec_()
		dlg.deleteLater()

	def hwmodConfig(self):
		dlg = HwmodConfigDialog(self.getProject(), self)
		dlg.settingsChanged.connect(self.__somethingChanged)
		dlg.exec_()
		dlg.deleteLater()

	def insertOB(self):
		self.projectWidget.insertOB()

	def insertFC(self):
		self.projectWidget.insertFC()

	def insertFB(self):
		self.projectWidget.insertFB()

	def insertInstanceDB(self):
		self.projectWidget.insertInstanceDB()

	def insertGlobalDB(self):
		self.projectWidget.insertGlobalDB()

	def insertUDT(self):
		self.projectWidget.insertUDT()

	def insertFCcall(self):
		self.projectWidget.insertFCcall()

	def insertFBcall(self):
		self.projectWidget.insertFBcall()

	def openLibrary(self):
		self.projectWidget.openLibrary()

	def undo(self):
		self.projectWidget.undo()

	def redo(self):
		self.projectWidget.redo()

	def cut(self):
		self.projectWidget.clipboardCut()

	def copy(self):
		self.projectWidget.clipboardCopy()

	def paste(self):
		self.projectWidget.clipboardPaste()

	def findText(self):
		self.projectWidget.findText()

	def findReplaceText(self):
		self.projectWidget.findReplaceText()

class MainWindow(QMainWindow):
	@classmethod
	def start(cls,
		  initialAwlSource = None):
		# Set basic qapp-details.
		# This is important for QSettings.
		QApplication.setOrganizationName("awlsim")
		QApplication.setApplicationName("Awlsim GUI")
		QApplication.setApplicationVersion(VERSION_STRING)

		mainwnd = cls(initialAwlSource)
		mainwnd.show()
		return mainwnd

	def __init__(self, awlSource=None, parent=None):
		QMainWindow.__init__(self, parent)
		self.setWindowIcon(getIcon("cpu"))
		self.setCentralWidget(MainWidget(self))

		self.tb = QToolBar(self)
		self.tb.addAction(getIcon("new"), "New project", self.new)
		self.tb.addAction(getIcon("open"), "Open project", self.load)
		self.tbSaveAct = self.tb.addAction(getIcon("save"), "Save project", self.save)
		self.tb.addSeparator()
		self.tbUndoAct = self.tb.addAction(getIcon("undo"), "Undo last edit", self.undo)
		self.tbRedoAct = self.tb.addAction(getIcon("redo"), "Redo", self.redo)
		self.tb.addSeparator()
		self.tbCutAct = self.tb.addAction(getIcon("cut"), "Cut", self.cut)
		self.tbCopyAct = self.tb.addAction(getIcon("copy"), "Copy", self.copy)
		self.tbPasteAct = self.tb.addAction(getIcon("paste"), "Paste", self.paste)
		self.tb.addSeparator()
		self.tbFindAct = self.tb.addAction(getIcon("find"), "Find...", self.findText)
		self.tbFindReplaceAct = self.tb.addAction(getIcon("findreplace"),
							  "Find and replace...", self.findReplaceText)
		self.tb.addSeparator()
		self.tbLibAct = self.tb.addAction(getIcon("stdlib"), "Standard library", self.openLibrary)
		self.addToolBar(Qt.TopToolBarArea, self.tb)

		self.ctrlTb = CpuControlToolBar(self)
		self.addToolBar(Qt.TopToolBarArea, self.ctrlTb)

		self.inspectTb = CpuInspectToolBar(self)
		self.addToolBar(Qt.RightToolBarArea, self.inspectTb)

		self.setMenuBar(QMenuBar(self))

		menu = QMenu("&File", self)
		menu.addAction(getIcon("new"), "&New project", self.new)
		menu.addAction(getIcon("open"), "&Open project...", self.load)
		self.saveAct = menu.addAction(getIcon("save"), "&Save project", self.save)
		menu.addAction(getIcon("save"), "&Save project as...", self.saveAs)
		menu.addSeparator()
		menu.addAction(getIcon("exit"), "&Exit...", self.close)
		self.menuBar().addMenu(menu)

		menu = QMenu("&Edit", self)
		self.undoAct = menu.addAction(getIcon("undo"), "&Undo", self.undo)
		self.redoAct = menu.addAction(getIcon("redo"), "&Redo", self.redo)
		menu.addSeparator()
		self.cutAct = menu.addAction(getIcon("cut"), "&Cut", self.cut)
		self.copyAct = menu.addAction(getIcon("copy"), "&Copy", self.copy)
		self.pasteAct = menu.addAction(getIcon("paste"), "&Paste", self.paste)
		menu.addSeparator()
		self.findAct = menu.addAction(getIcon("find"), "&Find...", self.findText)
		self.findReplaceAct = menu.addAction(getIcon("findreplace"),
						     "Find and r&eplace...", self.findReplaceText)
		self.menuBar().addMenu(menu)

		menu = QMenu("&Library", self)
		menu.addAction(getIcon("textsource"), "Insert &OB template...", self.insertOB)
		menu.addAction(getIcon("textsource"), "Insert F&C template...", self.insertFC)
		menu.addAction(getIcon("textsource"), "Insert F&B template...", self.insertFB)
		menu.addAction(getIcon("textsource"), "Insert &instance-DB template...", self.insertInstanceDB)
		menu.addAction(getIcon("textsource"), "Insert &DB template...", self.insertGlobalDB)
		menu.addAction(getIcon("textsource"), "Insert &UDT template...", self.insertUDT)
		menu.addSeparator()
		menu.addAction(getIcon("textsource"), "Insert FC C&ALL template...", self.insertFCcall)
		menu.addAction(getIcon("textsource"), "Insert FB CA&LL template...", self.insertFBcall)
		menu.addSeparator()
		self.libAct = menu.addAction(getIcon("stdlib"), "&Standard library...", self.openLibrary)
		self.menuBar().addMenu(menu)

		menu = QMenu("&Settings", self)
		menu.addAction(getIcon("network"), "&Server connection...", self.linkConfig)
		menu.addAction(getIcon("cpu"), "&CPU config...", self.cpuConfig)
		menu.addAction(getIcon("hwmod"), "&Hardware modules...", self.hwmodConfig)
		menu.addAction(getIcon("prefs"), "&User interface...", self.guiConfig)
		self.menuBar().addMenu(menu)

		menu = QMenu("&CPU", self)
		menu.addAction(self.ctrlTb.onlineAction)
		menu.addAction(self.ctrlTb.downloadAction)
		menu.addAction(self.ctrlTb.downloadSingleAction)
		menu.addAction(self.ctrlTb.runAction)
		menu.addAction(self.ctrlTb.diagAction)
		menu.addSeparator()
		menu.addAction(self.inspectTb.blocksAction)
		menu.addAction(self.inspectTb.inputsAction)
		menu.addAction(self.inspectTb.outputsAction)
		menu.addAction(self.inspectTb.flagsAction)
		menu.addAction(self.inspectTb.dbAction)
		menu.addAction(self.inspectTb.timerAction)
		menu.addAction(self.inspectTb.counterAction)
		menu.addAction(self.inspectTb.cpuAction)
		menu.addAction(self.inspectTb.lcdAction)
		self.menuBar().addMenu(menu)

		menu = QMenu("&Help", self)
		menu.addAction(getIcon("browser"), "Awlsim &homepage...", self.awlsimHomepage)
		menu.addSeparator()
		menu.addAction(getIcon("cpu"), "&About...", self.about)
		self.menuBar().addMenu(menu)

		self.__sourceTextHasFocus = False
		self.__dirtyChanged(False)
		self.__selResourceChanged(ProjectWidget.RES_SOURCES)
		self.__textFocusChanged(False)
		self.__undoAvailableChanged(False)
		self.__redoAvailableChanged(False)
		self.__copyAvailableChanged(False)

		self.centralWidget().projectLoaded.connect(self.__handleProjectLoaded)
		self.centralWidget().dirtyChanged.connect(self.__dirtyChanged)
		self.centralWidget().textFocusChanged.connect(self.__textFocusChanged)
		self.centralWidget().selResourceChanged.connect(self.__selResourceChanged)
		self.centralWidget().undoAvailableChanged.connect(self.__undoAvailableChanged)
		self.centralWidget().redoAvailableChanged.connect(self.__redoAvailableChanged)
		self.centralWidget().copyAvailableChanged.connect(self.__copyAvailableChanged)
		self.ctrlTb.connectToCpuWidget(self.centralWidget().cpuWidget)
		self.inspectTb.connectToCpuWidget(self.centralWidget().cpuWidget)

		if awlSource:
			self.centralWidget().loadFile(awlSource)

	def insertOB(self):
		self.centralWidget().insertOB()

	def insertFC(self):
		self.centralWidget().insertFC()

	def insertFB(self):
		self.centralWidget().insertFB()

	def insertInstanceDB(self):
		self.centralWidget().insertInstanceDB()

	def insertGlobalDB(self):
		self.centralWidget().insertGlobalDB()

	def insertUDT(self):
		self.centralWidget().insertUDT()

	def insertFCcall(self):
		self.centralWidget().insertFCcall()

	def insertFBcall(self):
		self.centralWidget().insertFBcall()

	def getSimClient(self):
		return self.centralWidget().getSimClient()

	def __dirtyChanged(self, isDirty):
		self.saveAct.setEnabled(isDirty)
		self.tbSaveAct.setEnabled(isDirty)

		filename = self.centralWidget().getFilename()
		if filename:
			postfix = " -- " + os.path.basename(filename)
			if isDirty:
				postfix += "*"
		else:
			postfix = ""
		self.setWindowTitle("AWL/STL soft-PLC v%s%s" %\
				    (VERSION_STRING, postfix))

	def __handleProjectLoaded(self, project):
		self.__updateLibActions()
		self.__updateFindActions()

	def __updateFindActions(self):
		if self.__selProjectResource == ProjectWidget.RES_SOURCES:
			self.tbFindAct.setEnabled(True)
			self.tbFindReplaceAct.setEnabled(True)
			self.findAct.setEnabled(True)
			self.findReplaceAct.setEnabled(True)
		else:
			self.tbFindAct.setEnabled(False)
			self.tbFindReplaceAct.setEnabled(False)
			self.findAct.setEnabled(False)
			self.findReplaceAct.setEnabled(False)

	def __updateLibActions(self):
		# Enable/disable the library toolbar button.
		# The menu library button is always available on purpose.
		if self.tbLibAct.isEnabled():
			if self.__selProjectResource != ProjectWidget.RES_SOURCES:
				self.tbLibAct.setEnabled(False)
				self.tbLibAct.setToolTip("Standard library.\n"
					"Please click in the AWL/STL source "
					"code at the place where to paste the "
					"library call.")
		else:
			if self.__selProjectResource == ProjectWidget.RES_SOURCES and\
			   self.__sourceTextHasFocus:
				self.tbLibAct.setEnabled(True)
				self.tbLibAct.setToolTip("Standard library")

	def __textFocusChanged(self, textHasFocus):
		self.__sourceTextHasFocus = textHasFocus
		self.__updateLibActions()
		self.__updateFindActions()

	def __selResourceChanged(self, resourceNumber):
		self.__selProjectResource = resourceNumber
		self.__updateLibActions()
		self.__updateFindActions()

	def __updateUndoActions(self):
		self.undoAct.setEnabled(
			self.__undoAvailable and
			self.__selProjectResource == ProjectWidget.RES_SOURCES
		)
		self.tbUndoAct.setEnabled(self.undoAct.isEnabled())

	def __undoAvailableChanged(self, undoAvailable):
		self.__undoAvailable = undoAvailable
		self.__updateUndoActions()

	def __updateRedoActions(self):
		self.redoAct.setEnabled(
			self.__redoAvailable and
			self.__selProjectResource == ProjectWidget.RES_SOURCES
		)
		self.tbRedoAct.setEnabled(self.redoAct.isEnabled())

	def __redoAvailableChanged(self, redoAvailable):
		self.__redoAvailable = redoAvailable
		self.__updateRedoActions()

	def __updateClipboardActions(self):
		self.cutAct.setEnabled(
			self.__copyAvailable and
			self.__selProjectResource == ProjectWidget.RES_SOURCES
		)
		self.tbCutAct.setEnabled(self.cutAct.isEnabled())
		self.copyAct.setEnabled(self.cutAct.isEnabled())
		self.tbCopyAct.setEnabled(self.copyAct.isEnabled())

	def __copyAvailableChanged(self, copyAvailable):
		self.__copyAvailable = copyAvailable
		self.__updateClipboardActions()

	def closeEvent(self, ev):
		if self.centralWidget().isDirty():
			res = QMessageBox.question(self,
				"Unsaved AWL/STL code",
				"The editor contains unsaved AWL/STL code.\n"
				"AWL/STL code will be lost by exiting without saving.",
				QMessageBox.Discard | QMessageBox.Save | QMessageBox.Cancel,
				QMessageBox.Cancel)
			if res == QMessageBox.Save:
				if not self.centralWidget().save():
					ev.ignore()
					return
			elif res == QMessageBox.Cancel:
				ev.ignore()
				return
		self.centralWidget().getSimClient().shutdown()
		ev.accept()
		QMainWindow.closeEvent(self, ev)

	def awlsimHomepage(self):
		QDesktopServices.openUrl(QUrl(AWLSIM_HOME_URL, QUrl.StrictMode))

	def about(self):
		QMessageBox.about(self, "About AWL/STL soft-PLC",
			"Awlsim soft-PLC version %s\n"
			"\n"
			"Copyright 2012-2016 Michael Büsch <m@bues.ch>\n"
			"\n"
			"Project home:  %s\n"
			"\n"
			"\n"
			"This program is free software; you can redistribute it and/or modify "
			"it under the terms of the GNU General Public License as published by "
			"the Free Software Foundation; either version 2 of the License, or "
			"(at your option) any later version.\n"
			"\n"
			"This program is distributed in the hope that it will be useful, "
			"but WITHOUT ANY WARRANTY; without even the implied warranty of "
			"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
			"GNU General Public License for more details.\n"
			"\n"
			"You should have received a copy of the GNU General Public License along "
			"with this program; if not, write to the Free Software Foundation, Inc., "
			"51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." %\
			(VERSION_STRING, AWLSIM_HOME_URL))

	def new(self):
		self.centralWidget().newFile()

	def load(self):
		self.centralWidget().load()

	def save(self):
		self.centralWidget().save()

	def saveAs(self):
		self.centralWidget().save(True)

	def guiConfig(self):
		self.centralWidget().guiConfig()

	def hwmodConfig(self):
		self.centralWidget().hwmodConfig()

	def linkConfig(self):
		self.centralWidget().linkConfig()

	def cpuConfig(self):
		self.centralWidget().cpuConfig()

	def openLibrary(self):
		self.centralWidget().openLibrary()

	def undo(self):
		self.centralWidget().undo()

	def redo(self):
		self.centralWidget().redo()

	def cut(self):
		self.centralWidget().cut()

	def copy(self):
		self.centralWidget().copy()

	def paste(self):
		self.centralWidget().paste()

	def findText(self):
		self.centralWidget().findText()

	def findReplaceText(self):
		self.centralWidget().findReplaceText()
bues.ch cgit interface