Skip to content

Commit 3ca43ad

Browse files
committed
qtdragon -little code cleanup
1 parent 8594003 commit 3ca43ad

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

share/qtvcp/screens/qtdragon/qtdragon_handler.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from qtvcp.lib.writer import writer
1010
from qtvcp.lib.keybindings import Keylookup
1111
from qtvcp.lib.gcodes import GCodes
12-
from qtvcp.lib.qt_pdf import PDFViewer
12+
from qtvcp.lib.qt_pdf import PDFViewer
1313
from qtvcp.core import Status, Action, Info, Path, Qhal
1414
from qtvcp import logger
1515
from shutil import copyfile
@@ -158,13 +158,12 @@ def initialized__(self):
158158
# web view widget for SETUP page
159159
if self.w.web_view:
160160
self.toolBar = QtWidgets.QToolBar(self.w)
161-
self.w.layout_HTML.addWidget(self.toolBar)
161+
self.w.tabWidget_setup.setCornerWidget(self.toolBar)
162162

163163
self.backBtn = QtWidgets.QPushButton(self.w)
164164
self.backBtn.setEnabled(True)
165165
self.backBtn.setIconSize(QtCore.QSize(48, 38))
166166
self.backBtn.setIcon(QtGui.QIcon(':/qt-project.org/styles/commonstyle/images/left-32.png'))
167-
168167
self.backBtn.clicked.connect(self.back)
169168
self.toolBar.addWidget(self.backBtn)
170169

@@ -849,9 +848,9 @@ def chk_use_virtual_changed(self, state):
849848
# tab is selected
850849
def tab_utilities_changed(self, num):
851850
if num == 2:
852-
self.w.stackedWidget.setCurrentIndex(4)
851+
self.w.stackedWidget.setCurrentIndex(PAGE_NGCGUI)
853852
else:
854-
self.w.stackedWidget.setCurrentIndex(0)
853+
self.w.stackedWidget.setCurrentIndex(PAGE_GCODE)
855854

856855
#####################
857856
# GENERAL FUNCTIONS #
@@ -887,9 +886,10 @@ def load_code(self, fname):
887886
fname = filename+'.pdf'
888887
if os.path.exists(fname):
889888
self.PDFView.loadView(fname)
890-
#url = QtCore.QUrl.fromLocalFile(fname)
891-
#QtGui.QDesktopServices.openUrl(url)
892889
self.add_status("Loaded PDF file : {}".format(fname))
890+
else:
891+
self.PDFView.loadSample('setup_tab')
892+
893893
return
894894

895895
# loading HTML/PDF directly
@@ -907,8 +907,6 @@ def load_code(self, fname):
907907
else:
908908
if os.path.exists(fname):
909909
self.PDFView.loadView(fname)
910-
#url = QtCore.QUrl.fromLocalFile(fname)
911-
#QtGui.QDesktopServices.openUrl(url)
912910
self.add_status("Loaded PDF file : {}".format(fname))
913911

914912
def disable_spindle_pause(self):
@@ -1119,6 +1117,7 @@ def adjust_stacked_widgets(self,requestedIndex):
11191117
# give a warning and reset the button check
11201118
if main_index != requestedIndex and not main_index in(TAB_CAMERA,TAB_GCODES,TAB_SETUP):
11211119
self.add_status("Cannot switch pages while in AUTO mode", WARNING)
1120+
self.w.main_tab_widget.setCurrentIndex(0)
11221121
self.w.btn_main.setChecked(True)
11231122

11241123
#####################

0 commit comments

Comments
 (0)