class WordAddonSettingsDialog(gui.SettingsDialog): # Translators: This is the title for the Word addon settings dialog title = _("%s - settings") % _unicode(_curAddon.manifest['summary']) def makeSettings(self, settingsSizer): sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) self.skipEmptyParagraphBox = sHelper.addItem( wx.CheckBox(self, wx.ID_ANY, label=_("&Skip empty paragraph"))) self.skipEmptyParagraphBox.SetValue( _addonConfigManager.toggleSkipEmptyParagraphsOption(False)) self.playSoundOnSkippedParagraphBox = sHelper.addItem( wx.CheckBox(self, wx.ID_ANY, label=_("&Play sound when paragraph is skipped"))) self.playSoundOnSkippedParagraphBox.SetValue( _addonConfigManager.togglePlaySoundOnSkippedParagraphOption(False)) def postInit(self): self.skipEmptyParagraphBox.SetFocus() def onOk(self, evt): if self.skipEmptyParagraphBox.IsChecked( ) != _addonConfigManager.toggleSkipEmptyParagraphsOption(False): _addonConfigManager.toggleSkipEmptyParagraphsOption() if self.playSoundOnSkippedParagraphBox.IsChecked( ) != _addonConfigManager.togglePlaySoundOnSkippedParagraphOption( False): _addonConfigManager.togglePlaySoundOnSkippedParagraphOption() super(WordAddonSettingsDialog, self).onOk(evt)
def label(self): author=self.collectionItem.author date=self.collectionItem.date text=self.collectionItem.range.text if text == None: text = "" return NVDAString(_unicode("comment: {text} by {author} on {date}")).format(author=author,text=text,date=date)
def formatInfosForClipboard(self): count = len(self.collection) if count == 0: return "" elif count == 1: sTitle = "" sSummary = _unicode("{title}: ").format(title=self.title) else: sSummary = _unicode("{title}: {count}").format(title=elf.title, count=count) sTitle = _unicode("{name} {index}:") sText = sSummary for item in self.collection: index = self.collection.index(item)+1 if sTitle != "": sText = sText + "\r\n" + sTitle.format(name=self._name[0], index=index) sText = sText + "\r\n" + item.formatInfos() return sText
def label(self): msg = _(_unicode("Section {index}")) return msg.format(index=self.collectionItem.index)
def label(self): text = self.collectionItem.text if len(text) > 100: text = "%s ..." % text[:100] msg = _(_unicode("{text}")) return msg.format(text=text)
def label(self): return _unicode("%s") % self.collectionItem.name
def label(self): msg = _unicode("{name}") return msg.format(name=self.collectionItem.Name)
def label(self): typeText = Field._getTypeText(self.collectionItem.type) # Translators: field index and type. msg = _(_unicode("Field {index}, type: {type}")) return msg.format(index=self.collectionItem.index, type=typeText)
from .ww_comments import Comments from .ww_revisions import Revisions from .ww_browseMode import * from . import ww_document import sys _curAddon = addonHandler.getCodeAddon() path = os.path.join(_curAddon.path, "shared") sys.path.append(path) from ww_utils import printDebug, maximizeWindow, toggleDebugFlag from ww_informationDialog import InformationDialog from ww_NVDAStrings import NVDAString from ww_py3Compatibility import _unicode from ww_addonConfigManager import _addonConfigManager del sys.path[-1] _addonSummary = _unicode(_curAddon.manifest['summary']) _scriptCategory = _addonSummary # global timer GB_scriptTimer = None # maximum delay for waiting new script call _delay = 250 def stopScriptTimer(): global GB_scriptTimer if GB_scriptTimer != None: GB_scriptTimer.Stop() GB_scriptTimer = None
def formatInfos(self): (yes, no) = (_("yes"), _("no")) start = wdSectionStart[self.sectionStart] oddAndEven = firstPage = no if self.oddAndEvenPagesHeaderFooter: oddAndEven = yes if self.differentFirstPageHeaderFooter: firstPage = yes headerDistance = "%.2f cm" % convertPixelToUnit(self.headerDistance) footerDistance = "%.2f cm" % convertPixelToUnit(self.footerDistance) verticalAlignment = wdVerticalAlignment[self.verticalAlignment] disposition = _("""Disposition: Section's start: {start} Header / footer's even or odd pages different: {oddAndEven} Header/footer's first page different: {firstPage} Header distance from top: {headerDistance} Footer distance from bottom: {footerDistance} Vertical alignment: {verticalAlignment} """) .format( start=start, oddAndEven=oddAndEven, firstPage=firstPage, headerDistance=headerDistance, footerDistance=footerDistance, verticalAlignment=verticalAlignment) # margins left = "%.2f cm" % convertPixelToUnit(self.leftMargin) right = "%.2f cm" % convertPixelToUnit(self.rightMargin) top = "%.2f cm" % convertPixelToUnit(self.topMargin) bottom = "%.2f cm" % convertPixelToUnit(self.bottomMargin) orientation = wdOrientations[self.orientation] margins = _(_unicode("""Margins: Left,right: {left}, {right} Top, bottom: {top}, {bottom} Orientation: {orientation} """)).format( left=left, right=right, top=top, bottom=bottom, orientation=orientation) # paper paperSize = wdPaperSize[self.paperSize] width = "%.2f cm" % convertPixelToUnit(self.pageWidth) height = "%.2f cm" % convertPixelToUnit(self.pageHeight) sectionDirection = wdSectionDirection[self.sectionDirection] paper = _(_unicode("""Paper: Format: {paperSize} Height's heet: {height} Width's sheet: {width} Two pages per sheet: {twoPages} """)) .format( paperSize=paperSize, height=height, width=width, twoPages=yes if self.twoPagesOnOne else no) # page chars = int(self.charsLine) lines = int(self.linesPage) pageFormat = _(_unicode("""Page: Chars number per line: {chars} Lines number per page: {lines} {sectionDirection} """)).format(chars=chars, lines=lines, sectionDirection=sectionDirection) sInfo = (_unicode("""{disposition} {margins} {paper} {pageFormat} """)).format( disposition=disposition, margins=margins, paper=paper, pageFormat=pageFormat) sInfo = sInfo.replace("\n", "\r\n") return sInfo
def label(self): return _(_unicode("Section {index}")).format(index =self.collectionItem.index)
def label(self): return _unicode("{name}").format(name =self.collectionItem.Name)
def label(self): typeText = Field._getTypeText(self.collectionItem.type) return _(_unicode("Field {index}, type: {type}")).format(index =self.collectionItem.index, type = typeText)
class WordAddonSettingsDialog(gui.SettingsDialog): # Translators: This is the title for the Word addon settings dialog title = _("%s - settings") % _unicode(_curAddon.manifest['summary']) def makeSettings(self, settingsSizer): sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Translators: This is the label for a checkbox in the settings panel. self.skipEmptyParagraphBox = sHelper.addItem( wx.CheckBox(self, wx.ID_ANY, label=_("&Skip empty paragraph"))) self.skipEmptyParagraphBox.SetValue( _addonConfigManager.toggleSkipEmptyParagraphsOption(False)) # Translators: This is the label for a checkbox in the settings panel. self.playSoundOnSkippedParagraphBox = sHelper.addItem( wx.CheckBox(self, wx.ID_ANY, label=_("&Play sound when paragraph is skipped"))) self.playSoundOnSkippedParagraphBox.SetValue( _addonConfigManager.togglePlaySoundOnSkippedParagraphOption(False)) # Translators: This is the label for a group of editing options in the settings panel. groupText = _("Update") group = gui.guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer( wx.StaticBox(self, label=groupText), wx.VERTICAL)) sHelper.addItem(group) # Translators: This is the label for a checkbox in the settings panel. labelText = _("Automatically check for &updates ") self.autoCheckForUpdatesCheckBox = group.addItem( wx.CheckBox(self, wx.ID_ANY, label=labelText)) self.autoCheckForUpdatesCheckBox.SetValue( _addonConfigManager.toggleAutoUpdateCheck(False)) # Translators: This is the label for a checkbox in the settings panel. labelText = _( "Update also release versions to &developpement versions") self.updateReleaseVersionsToDevVersionsCheckBox = group.addItem( wx.CheckBox(self, wx.ID_ANY, label=labelText)) self.updateReleaseVersionsToDevVersionsCheckBox.SetValue( _addonConfigManager.toggleUpdateReleaseVersionsToDevVersions( False)) # Translators: This is the label for a button in the settings panel. labelText = _("&Check for update") checkForUpdateButton = wx.Button(self, label=labelText) group.addItem(checkForUpdateButton) checkForUpdateButton.Bind(wx.EVT_BUTTON, self.onCheckForUpdate) def onCheckForUpdate(self, evt): from .updateHandler import addonUpdateCheck wx.CallAfter(addonUpdateCheck, auto=False, releaseToDev=_addonConfigManager. toggleUpdateReleaseVersionsToDevVersions(False)) self.Close() def postInit(self): self.skipEmptyParagraphBox.SetFocus() def saveSettingChanges(self): if self.skipEmptyParagraphBox.IsChecked( ) != _addonConfigManager.toggleSkipEmptyParagraphsOption(False): _addonConfigManager.toggleSkipEmptyParagraphsOption() if self.playSoundOnSkippedParagraphBox.IsChecked( ) != _addonConfigManager.togglePlaySoundOnSkippedParagraphOption( False): _addonConfigManager.togglePlaySoundOnSkippedParagraphOption() if self.autoCheckForUpdatesCheckBox.IsChecked( ) != _addonConfigManager.toggleAutoUpdateCheck(False): _addonConfigManager.toggleAutoUpdateCheck(True) if self.updateReleaseVersionsToDevVersionsCheckBox.IsChecked( ) != _addonConfigManager.toggleUpdateReleaseVersionsToDevVersions( False): _addonConfigManager.toggleUpdateReleaseVersionsToDevVersions(True) def onOk(self, evt): self.saveSettingChanges() super(WordAddonSettingsDialog, self).onOk(evt)