eric6/QScintilla/EditorButtonsWidget.py

changeset 8243
cc717c2ae956
parent 8218
7c09585bd960
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
5 5
6 """ 6 """
7 Module implementing a widget containing various buttons for accessing 7 Module implementing a widget containing various buttons for accessing
8 editor actions. 8 editor actions.
9 """ 9 """
10
11 import contextlib
10 12
11 from PyQt5.QtCore import pyqtSlot, Qt 13 from PyQt5.QtCore import pyqtSlot, Qt
12 from PyQt5.QtWidgets import ( 14 from PyQt5.QtWidgets import (
13 QWidget, QVBoxLayout, QToolButton, QFrame, QMenu, QSizePolicy, QScrollArea 15 QWidget, QVBoxLayout, QToolButton, QFrame, QMenu, QSizePolicy, QScrollArea
14 ) 16 )
303 elif formatName == "italic": 305 elif formatName == "italic":
304 self.__provider.italic(self.__editor) 306 self.__provider.italic(self.__editor)
305 elif formatName == "strikethrough": 307 elif formatName == "strikethrough":
306 self.__provider.strikethrough(self.__editor) 308 self.__provider.strikethrough(self.__editor)
307 elif formatName.startswith("header"): 309 elif formatName.startswith("header"):
308 try: 310 with contextlib.suppress(ValueError):
309 level = int(formatName[-1]) 311 level = int(formatName[-1])
310 self.__provider.header(self.__editor, level) 312 self.__provider.header(self.__editor, level)
311 except ValueError:
312 pass
313 elif formatName == "code": 313 elif formatName == "code":
314 self.__provider.code(self.__editor) 314 self.__provider.code(self.__editor)
315 elif formatName == "codeBlock": 315 elif formatName == "codeBlock":
316 self.__provider.codeBlock(self.__editor) 316 self.__provider.codeBlock(self.__editor)
317 elif formatName == "quote": 317 elif formatName == "quote":

eric ide

mercurial