def _create_gedit_item(self, file):
		"""Creates the 'Edit as Administrator' menu item."""
		item = Nautilus.MenuItem(name="NautilusAdmin::Gedit",
		                         label=gettext("Edit as A_dministrator"),
		                         tip=gettext("Open this file in the text editor with root privileges"))
		item.connect("activate", self._gedit_run, file)
		return item
	def _create_nautilus_item(self, file):
		"""Creates the 'Open as Administrator' menu item."""
		item = Nautilus.MenuItem(name="NautilusAdmin::Nautilus",
		                         label=gettext("Open as A_dministrator"),
		                         tip=gettext("Open this folder with root privileges"))
		item.connect("activate", self._nautilus_run, file)
		return item
Example #3
0
	def build_toolbar(self):
		toolbar_box = ToolbarBox()
		self.set_toolbar_box(toolbar_box)
		toolbar_box.show()
		
		activity_button = ActivityToolbarButton(self)
		toolbar_box.toolbar.insert(activity_button, -1)
		activity_button.show()

		#Play/Pause button
		stop_play = ToolButton('media-playback-stop')
		stop_play.set_tooltip(gettext("Stop"))
		stop_play.set_accelerator(gettext('<ctrl>space'))
		stop_play.connect('clicked', self._stop_play_cb)
		
		toolbar_box.toolbar.insert(stop_play, -1)
		stop_play.show()

		#Separator
		separator = Gtk.SeparatorToolItem()
		separator.props.draw = False
		separator.set_expand(True)
		
		toolbar_box.toolbar.insert(separator, -1)
		separator.show()

		#Stop button
		stop_button = StopButton(self)
		toolbar_box.toolbar.insert(stop_button, -1)
		stop_button.show()
Example #4
0
 def construct_gettext(self, node):
     if isinstance(node, yaml.SequenceNode):
         items = []
         for i, each in enumerate(node.value):
             items.append(gettext.gettext(node.value[i].value))
         return items
     return gettext.gettext(node.value)
 def __init__(self):
     super().__init__()
     Ruler.logo, Ruler.menu= QPixmap(path.join(path.dirname(path.realpath(__file__)), "png", "%s.png" % PROJECT_NAME.lower())), False
     self.setWindowIcon(QIcon(Ruler.logo))
     self.setWindowFlags(Qt.Tool|Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.customContextMenuRequested.connect(self.openContextMenu)
     self.about, self.orientation, self.unitMeasure= gettext("About"), [ gettext("Horizontal"), gettext("Vertical") ], [ [ [ gettext("Pixel"), gettext("px") ], [ 1, 1 ] ], [ [ gettext("Point"), gettext("pt"), 1 ], [ self.logicalDpiX() / 6 * 2, self.logicalDpiY() / 6 * 2 ] ], [ [ gettext("Inch"), gettext("in") ], [ self.logicalDpiX(), self.logicalDpiY() ] ], [ [ gettext("Pica"), gettext("pc"), 1 ], [ self.logicalDpiX() / 6, self.logicalDpiY() / 6 ] ], [ [ gettext("Centimeter"), gettext("cm") ], [ self.logicalDpiX() / 2.54, self.logicalDpiY() / 2.54 ] ] ]
     self.screen, self.colors= app.desktop().screenGeometry().bottomRight(), [ [ [ gettext("Text"), QColor(230, 230, 250) ] ], [ [ gettext("Background"), QColor(0, 30, 120) ] ], [ [ gettext("Highlight"), QColor(220, 0, 0) ] ], [ [ gettext("Default Colors") ] ] ]
     self.sX, self.sY, self.rulerSize, self.cursor, self.mouseTimer, self.defaultColors= 600, 70, [ [ [ gettext("Normal") ] ], [ [ gettext("x2") ] ], [ [ gettext("x3") ] ], [ [ gettext("x4") ] ] ], None, QTimer(self), deepcopy(self.colors)
     self.pix, self.ps, self.csec, self.moving, self.ps, self.zooms, self.mark, self.settings= None, app.primaryScreen(), time(), False, app.primaryScreen(), [ [ [ gettext("None") ] ], [ [ self.rulerSize[1][0][0] ] ], [ [ self.rulerSize[2][0][0] ] ], [ [ self.rulerSize[3][0][0] ] ] ], deque(maxlen= 2), QSettings(PROJECT_TEAM, PROJECT_NAME)
     self.sXY= self.cUM= self.oH= self.zoom= 0
     self.cursorMove.connect(self.handleCursorMove)
     self.mouseTimer.setInterval(50)
     self.mouseTimer.timeout.connect(self.pollCursor)
     self.mouseTimer.start()
     for i, item in enumerate([ "Colors/Text", "Colors/Background", "Colors/Highlight" ]):
         if type(self.settings.value(item, None)) == type(QColor()) and self.settings.value(item, None).isValid():
             self.colors[i][0][1]= self.settings.value(item)
     for item in [ [ "GUI/Zoom", "mode", 2 ], [ "GUI/Orientation", "oH", 2 ], [ "GUI/Size", "sXY", len(self.colors) ], [ "GUI/UnitMeasure", "cUM", len(self.unitMeasure) ] ]:
         if int(self.settings.value(item[0], -1)) in range(1, item[2]):
             setattr(self, item[1], int(self.settings.value(item[0])))
     self.changeRulerSize(self.sXY)
     self.changeOrientation(self.oH)
     if self.settings.contains("GUI/Position"):
         self.move(self.settings.value("GUI/Position"))
     else:
         self.move(app.desktop().screen().rect().center() - self.rect().center())
     self.saveBackground()
Example #6
0
def doqtop(req):
  req.default_response()
  if req.qs.has_key('q'):
    q = req.qs['q'][0]
    try:
      q = int(q)
    except:
      req.wfile.write(gettext('Invalid number.'))
      return
    cu = database.cx.cursor()
    cu.execute('select id,name,total_use from costumers order by total_use desc, name asc limit %d;' % (q))
    a = cu.fetchone()
    if a:
      req.wfile.write('<ul>\n')
    else:
      req.wfile.write(gettext('No results found.'))
      cu.close()
      return
    while a:
      if a[2] > 60:
        if a[2] % 60 == 0:
          usetime = '%d h' % (a[2]/60)
        else:
          usetime = '%d h %d min' % (a[2]/60, a[2]%60)
      else:
        usetime = '%d min' % a[2]
      req.wfile.write("""
<li><a href="edit?id=%d">%s</a><br />[%s]</li>
""" % (a[0], a[1].encode('utf-8'), usetime))
      a = cu.fetchone()
    cu.close()
    req.wfile.write('<li>&nbsp;</li><li><a href="resettop">[%s]</a></li></ul>' % gettext('reset counter'))
  else:
    req.wfile.write(gettext('Please, type the number of costumers you want to display.'))
Example #7
0
    def addConfigSection(self, section, name, desc, long_desc, config, base=False):
        """Adds a section to the config. `config` is a list of config tuples as used in plugin api defined as:
        Either (name, type, verbose_name, default_value) or
                (name, type, verbose_name, short_description, default_value)
        The order of the config elements is preserved with OrderedDict
        """
        d = OrderedDict()

        for entry in config:
            if len(entry) == 5:
                conf_name, type, conf_desc, conf_verbose, default = entry
            else: # config options without tooltip / description
                conf_name, type, conf_desc, default = entry
                conf_verbose = ""

            d[conf_name] = ConfigData(gettext(conf_desc), type, gettext(conf_verbose), from_string(default, type))

        if base:
            if section not in self.baseSections: self.baseSections.append(section)
        elif section in self.baseSections:
            return # would overwrite base section

        data = SectionTuple(gettext(name), gettext(desc), gettext(long_desc), d)
        self.config[section] = data

        if section not in self.values:
            self.values[section] = {}
	def _show_warning_dialog(self):
		"""Shows a warning dialog it this is the first time the extension is
		used, and returns True if the user has pressed OK."""
		# Check if this is the first time the extension is used
		conf_dir = GLib.get_user_config_dir() # get "~/.config" path
		conf_file = os.path.join(conf_dir, ".nautilus-admin-warn-shown")
		if os.path.exists(conf_file):
			return True
		else:
			# Show the warning dialog
			self._setup_gettext();
			dialog = Gtk.MessageDialog(self.window, 0, Gtk.MessageType.WARNING,
			                           Gtk.ButtonsType.OK_CANCEL,
			                           gettext("CAUTION!"))
			msg = gettext("Running the File Manager or the Text Editor with Administrator "
			              "privileges <b>is dangerous</b>! <b>You can easily destroy your "
			              "system if you are not careful!</b>\n"
			              "Proceed only if you know what you are doing and understand the risks.")
			dialog.format_secondary_markup(msg)
			response = dialog.run()
			dialog.destroy()

			if response == Gtk.ResponseType.OK:
				# Mark the dialog as shown
				try:
					if not os.path.isdir(conf_dir):
						os.makedirs(conf_dir)
					open(conf_file, "w").close() # create an empty file
				except:
					pass
				return True
			else:
				return False
Example #9
0
def ldnp(td, ctxt, id, idp, n, *args):
    if not dir or nolocales: _die("please set a locale directory with l_dir() before using other translate functions")

    if idp: args = (n,) + args
    out = None
    if dry:
        if not nowrite:
            save = []
            if td: save.push(' # domain: '+td)
            if ctxt: save.push('msgctxt: "'+gettext_escape(ctxt)+'"')
            save.push('msgid "'+gettext_escape(id)+'"')
            if idp: save.push('msgid_plural "'+gettext_escape(idp)+'"')
            wd(save)
        out = (idp if idp and n != 1 else id) % args
    else:
        if       td and not ctxt and id and     idp and     n: out = sprintf(dngettext(td, id, idp, n), *args)
        elif not td and not ctxt and id and     idp and     n: out = sprintf(ngettext(id, idp, n), *args)
        elif not td and not ctxt and id and not idp and not n: out = sprintf(gettext(id), *args)
        elif     td and not ctxt and id and not idp and not n: out = sprintf(dgettext(td, id), *args)

        # with context magic
        if       td and     ctxt and id and     idp and     n: out = sprintf(dngettext(td, ctxt+'\x04'+id, ctxt+'\x04'+idp, n), *args)
        elif not td and     ctxt and id and     idp and     n: out = sprintf(ngettext(ctxt+'\x04'+id, ctxt+'\x04'+idp, n), *args)
        elif not td and     ctxt and id and not idp and not n: out = sprintf(gettext(ctxt+'\x04'+id), *args)
        elif     td and     ctxt and id and not idp and not n: out = sprintf(dgettext(td, ctxt+'\x04'+id), *args)
    return out
Example #10
0
	def __repr__(self):
		if self.customer is None:
			display_customer = "<%s>" % gettext("unknown customer")
		else:
			display_customer = self.customer.__repr__()

		return gettext("<Package for %s>") % display_customer
Example #11
0
def doqname(req):
  req.default_response()
  if req.qs.has_key('q'):
    q = req.qs['q'][0]
    s = ''
    if len(q) < 5:
      s = ' limit 20'
    q = q.replace("'","''")+'%'
    cu = database.cx.cursor()
    cu.execute("select id,name from costumers where name like ? order by name%s;" % s, (q,))
    a = cu.fetchone()
    if a:
      req.wfile.write('<ul>\n')
    else:
      req.wfile.write(gettext('No results found.'))
      cu.close()
      return
    while a:
      req.wfile.write("""<li><a href="edit?id=%d">%s</a></li>
""" % (a[0], a[1].encode('utf-8')))
      a = cu.fetchone()
    cu.close()
    if s != '':
      req.wfile.write('<li>...</li>\n')
    req.wfile.write('</ul>')
  else:
    req.wfile.write(gettext('Please, type the beginning of the name.'))
Example #12
0
	def __unicode__(self):
		if self.customer is None:
			display_customer = gettext("unknown customer")
		else:
			display_customer = self.customer.__unicode__()

		return gettext("Package %s of %s") % (self.a_domain, display_customer)
Example #13
0
	def mostrarListado(self):
		opcion = ""
		while (opcion != "back"):
			self.contenido = self.leerArchivo()
			self.label = snack.Label(self.texto)
			self.botones = snack.ButtonBar(self.screen,
										((gettext.gettext("Add"), "add"),
										(gettext.gettext("Delete"), "delete"),
										(gettext.gettext("Back"), "back")))
			self.lista = snack.Listbox(height=13,
									width=60,
									returnExit=1,
									showCursor=0,
									scroll=1)
			for registro in self.contenido:
				fecha = registro.split("\t")[1]
				recordView = registro.split("\t")[0] + "(" + fecha.strip(":created") + ")"
				self.lista.append(recordView, registro)
			self.grid = snack.GridForm(self.screen, self.titulo, 1, 3)
			self.grid.add(self.label, 0, 0, growx=0, growy=0, anchorLeft=1)
			self.grid.add(self.lista, 0, 1)
			self.grid.add(self.botones, 0, 2, growx=1, growy=0)
			respuesta = self.grid.runOnce()
			opcion = self.botones.buttonPressed(respuesta)
			if (opcion == "add"):
				cargaDeValores = Datos.Datos(self.archivo,
											gettext.gettext("New"),
											self.texto,
											self.screen)
				cargaDeValores.altas()
			elif (opcion == "delete"):
				self.guardarArchivo(self.lista.current())
Example #14
0
    def addConfigSection(self, section, label, desc, expl, config):
        """Adds a section to the config. `config` is a list of config tuples as used in plugin api defined as:
        The order of the config elements is preserved with OrderedDict
        """
        d = OrderedDict()

        for entry in config:
            if len(entry) != 4:
                raise ValueError("Config entry must be of length 4")

            # Values can have different roles depending on the two config formats
            conf_name, type_label, label_desc, default_input = entry

            # name, label, desc, input
            if isinstance(default_input, Input):
                input = default_input
                conf_label = type_label
                conf_desc = label_desc
            # name, type, label, default
            else:
                input = Input(to_input(type_label))
                input.default_value = from_string(default_input, input.type)
                conf_label = label_desc
                conf_desc = ""

            d[conf_name] = ConfigData(gettext(conf_label), gettext(conf_desc), input)

        data = SectionTuple(gettext(label), gettext(desc), gettext(expl), d)
        self.config[section] = data
    def onSendFeedback(self, event_):
        dlg = FeedbackDialog()
        if dlg.ShowModal() == wx.ID_OK:
            queryDict = {
                "pid": 10000,
                "summary": dlg.summary(),
                "description": dlg.description(),
                "customfield_10000": dlg.contactEmail(),
            }
            if platform.system() == "Darwin":
                environment = "OS: Mac OS X " + platform.mac_ver()[0] + "\n"
            elif platform.system() == "Windows":
                release, version, csd, ptype = platform.win32_ver()
                environment = "OS: Windows " + release + "  " + version + " " + csd + " " + ptype + "\n"
            else:
                environment = "OS: " + platform.system() + " " + platform.version() + "\n"
            environment += "Python version: " + platform.python_version() + "\n"
            queryDict["environment"] = environment
            if dlg.isBugReport():
                queryDict["issuetype"] = 1
            elif dlg.isFeatureRequest():
                queryDict["issuetype"] = 2
            # task = 3, improvement = 4
            queryDict["versions"] = __version__.JIRA_version_id
            url = "http://www.neuroptikon.org/issues/secure/CreateIssueDetails.jspa?" + urllib.urlencode(queryDict)
            if not wx.LaunchDefaultBrowser(url):
                message = gettext("The issue could not be created")
                resolution = gettext("Please visit http://www.neuroptikon.org/issues/ to send your feedback.")
                if platform.system() == "Darwin":
                    wx.MessageBox(resolution, message)
                else:
                    wx.MessageBox(gettext("Send Feedback"), message + "\n\n" + resolution)

        dlg.Destroy()
	def _create_exec_item(self, file):
		"""Creates the 'Run as Administrator' menu item."""
		item = Nautilus.MenuItem(name="NautilusAdmin::ExecAdmin",
		                         label=gettext("Run as A_dministrator"),
		                         tip=gettext("Run this file with root privileges"))
		item.connect("activate", self._exec_run, file)
		return item
 def get_sound(self, sound_file_name, text=None):
     '''add sounds_path and localizate sound name'''
     p = gettext.gettext(self.sounds_path)
     f = gettext.gettext(sound_file_name)
     snd = os.path.join(p, f)
     if text and not os.path.exists(snd):
         assert self.tts().synthesize(text, snd)
     return os.path.join(p, f)
Example #18
0
	def effect( self ):
		'''Main entry point: check to see which tab is selected, and act accordingly.'''

		self.svg = self.document.getroot()
		self.CheckSVGforEggbotData()

 		if ((self.options.tab == '"Help"') or (self.options.tab == '"options"')  or (self.options.tab == '"timing"')):
 			pass
 		else:
 			self.serialPort = ebb_serial.openPort()
 			if self.serialPort is None:
				inkex.errormsg( gettext.gettext( "Failed to connect to EggBot. :(" ) )

			if self.options.tab == '"splash"':
				self.allLayers = True
				self.plotCurrentLayer = True
				self.svgNodeCount = 0
				self.svgLastPath = 0
				unused_button = ebb_motion.QueryPRGButton(self.serialPort)	#Query if button pressed
				self.svgLayer = 12345;  # indicate that we are plotting all layers.
				self.plotToEggBot()
	
			elif self.options.tab == '"resume"':
				unused_button = ebb_motion.QueryPRGButton(self.serialPort)	#Query if button pressed
				self.resumePlotSetup()
				if self.resumeMode:
					self.plotToEggBot()
				elif ( self.options.cancelOnly ):
					pass
				else:
					inkex.errormsg( gettext.gettext( "Truly sorry, there does not seem to be any in-progress plot to resume." ) )
	
			elif self.options.tab == '"layers"':
				self.allLayers = False
				self.plotCurrentLayer = False
				self.LayersPlotted = 0
				self.svgLastPath = 0
				unused_button = ebb_motion.QueryPRGButton(self.serialPort)	#Query if button pressed
				self.svgNodeCount = 0;
				self.svgLayer = self.options.layernumber
				self.plotToEggBot()
				if ( self.LayersPlotted == 0 ):
					inkex.errormsg( gettext.gettext( "Truly sorry, but I did not find any numbered layers to plot." ) )
					
			elif self.options.tab == '"setup"':
				self.setupCommand()	
			elif self.options.tab == '"manual"':
				self.manualCommand()
				
			if self.serialPort is not None:
				ebb_motion.doTimedPause(self.serialPort, 10) #Pause a moment for underway commands to finish...
				ebb_serial.closePort(self.serialPort)	
				
		self.svgDataRead = False
		self.UpdateSVGEggbotData( self.svg )
		return
Example #19
0
def menuPrincipal():
    logger.info(gettext.gettext("Start system, Main menu."))
    exit = False
    while not exit:
        bb = ButtonBar(
            formulario,
            (
                (gettext.gettext("Collect"), "collect"),
                (gettext.gettext("Process"), "process"),
                (gettext.gettext("Organize"), "organize"),
                (gettext.gettext("Revise"), "revise"),
                (gettext.gettext("Exit"), "exit"),
            ),
        )
        g = GridForm(formulario, "slGTD 0.1", 1, 3)
        g.add(bb, 0, 0, (2, 2, 2, 2))

        resultado = g.runOnce()
        if bb.buttonPressed(resultado) == "collect":
            inboxMenu = Ventana.Ventana(file_inbox, "INBOX | slGTD", gettext.gettext("Tasks."), formulario)
            rta3 = inboxMenu.mostrarListado()
        elif bb.buttonPressed(resultado) == "exit":
            logger.info(gettext.gettext("Closed slGTD."))
            exit = True
        else:
            logger.error(gettext.gettext("Operation not permitted."))
Example #20
0
 def deleteUser(self, screen, table, registro):
     self.screen = screen
     self.table = table
     self.registro = registro
     confirmation = ButtonChoiceWindow(self.screen,
                                 gettext.gettext('Confirm'),
                                 gettext.gettext('are you sure to remove'),
                                 [gettext.gettext('Ok'),
                                 gettext.gettext('Cancel')], 60)
     if (confirmation == 'ok'):
         self.table.delete(self.registro.id)
Example #21
0
	def _stop_play_cb(self, button):
		self.paused = not self.paused
		self.game.paused = self.paused

		#Update button to show next action
		if(self.paused):
			button.set_icon('media-playback-start')
			button.set_tooltip(gettext("Start"))
		else:
			button.set_icon('media-playback-stop')
			button.set_tooltip(gettext("Stop"))
 def onAboutNeuroptikon(self, event_):
     info = wx.AboutDialogInfo()
     info.SetName(gettext("Neuroptikon"))
     info.SetVersion(__version__.version)
     info.SetDescription(
         gettext(
             "Developed at the \nJanelia Farm Research Campus by:\n\nFrank Midgley\nVivek Jayaraman\nMitya Chklovskii\nDon Olbris"
         )
     )
     info.SetCopyright(gettext("Copyright \xa9 2010 - Howard Hughes Medical Institute"))
     wx.AboutBox(info)
Example #23
0
    def addConfigSection(self, section, label, desc, expl, config):
        """Adds a section to the config. `config` is a list of config tuple as used in plugin api defined as:
        The order of the config elements is preserved with OrderedDict
        """
        d = OrderedDict()

        for entry in config:
            name, data = to_configdata(entry)
            d[name] = data

        data = SectionTuple(gettext(label), gettext(desc), gettext(expl), d)
        self.config[section] = data
Example #24
0
	def effect( self ):
		'''Main entry point: check to see which tab is selected, and act accordingly.'''

		self.svg = self.document.getroot()
		self.CheckSVGforEggbotData()

		if self.options.tab == '"splash"':
			self.allLayers = True
			self.plotCurrentLayer = True
			self.EggbotOpenSerial()
			self.svgNodeCount = 0
			self.svgLastPath = 0
			unused_button = self.doRequest( 'QB\r' ) #Query if button pressed
			self.svgLayer = 12345;  # indicate that we are plotting all layers.
			self.plotToEggBot()


		elif self.options.tab == '"resume"':
			self.EggbotOpenSerial()
			unused_button = self.doRequest( 'QB\r' ) #Query if button pressed
			self.resumePlotSetup()
			if self.resumeMode:
				self.plotToEggBot()
			elif ( self.options.cancelOnly ):
				pass
			else:
				inkex.errormsg( gettext.gettext( "Truly sorry, there does not seem to be any in-progress plot to resume." ) )

		elif self.options.tab == '"layers"':
			self.allLayers = False
			self.plotCurrentLayer = False
			self.LayersPlotted = 0
			self.svgLastPath = 0
			self.EggbotOpenSerial()
			unused_button = self.doRequest( 'QB\r' ) #Query if button pressed
			self.svgNodeCount = 0;
			self.svgLayer = self.options.layernumber
			self.plotToEggBot()
			if ( self.LayersPlotted == 0 ):
				inkex.errormsg( gettext.gettext( "Truly sorry, but I did not find any numbered layers to plot." ) )

		elif self.options.tab == '"setup"':
			self.EggbotOpenSerial()
			self.setupCommand()

		elif self.options.tab == '"manual"':
			self.EggbotOpenSerial()
			self.manualCommand()

		self.svgDataRead = False
		self.UpdateSVGEggbotData( self.svg )
		self.EggbotCloseSerial()
		return
Example #25
0
 def deleteGroup(self, screen, table, registro):
     self.screen = screen
     self.table = table
     self.registro = registro
     confirmation = ButtonChoiceWindow(
         self.screen,
         gettext.gettext("Confirm"),
         gettext.gettext("are you sure to remove"),
         [gettext.gettext("Ok"), gettext.gettext("Cancel")],
         60,
     )
     if confirmation == "ok":
         self.table.delete(self.registro.id)
Example #26
0
	def saved(self):
		self.removeSaving()
		thread = self.sender()

		if not thread.error:
			thread.item.setMark( QImage( ':/images/images/ok.png' ) )
			thread.item.setToolTip( gettext.gettext('nanscan','Image stored successfully') )
		else:
			thread.item.setMark( QImage( ':/images/images/cancel.png' ) )
			thread.item.setToolTip( gettext.gettext('nanscan','Error storing image') )
			
		# Free memory used by the BIG image
		thread.item.image = None
		gc.collect()
Example #27
0
def invalid_usercode(req):
    req.wfile.write(
        """
<td><img src="alertimg" /></td><td width="100%%">%s</td>
"""
        % gettext("The user code is invalid.")
    )
def _(txt):
    if config.plugins.xModem.nolocale.value:
        return txt
    t = gettext.dgettext(PluginLangDomain, txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #29
0
def _(txt):
	t = gettext.dgettext(PluginLanguageDomain, txt)
	if t == txt:
		t = getDefaultTxt(txt)
		if t == txt:
			t = gettext.gettext(txt)
	return t
Example #30
0
	def __init__(self, archivo, titulo, texto, screen=None):
		self.archivo = archivo
		self.titulo = titulo
		self.texto = texto
		self.screen = screen
		if (titulo == ""):
			self.titulo = gettext.gettext("No Title")
Example #31
0
def _(txt):
    t = gettext.dgettext('PPFlashBackup', txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #32
0
def _(txt):
    t = gettext.dgettext(PluginLanguageDomain, txt)
    if t == txt:
        print "[NetworkServer] fallback to default translation for", txt
        t = gettext.gettext(txt)
    return t
Example #33
0
 def error(self, message):
     self.print_help(sys.stderr)
     self.exit(2, gettext.gettext('%s: error: %s\n') % (self.prog, message))
Example #34
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts
        self._lang_sid = 0
        self._selected_lang_count = 0
        self._labels = []
        self._language_dict = {}
        self._country_dict = {}
        self._language_buttons = []
        self._country_buttons = []
        self._language_widgets = []
        self._country_widgets = []
        self._country_codes = []
        self._add_remove_boxes = []
        self._changed = False
        self._cursor_change_handler = None

        self._available_locales = self._model.read_all_languages()
        self._selected_locales = self._model.get_languages()

        for language, country, code in self._available_locales:
            if language not in self._language_dict:
                self._language_dict[language] = _translate_language(language)
                self._country_dict[language] = [[code, country]]
            else:
                self._country_dict[language].append([code, country])

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        explanation = gettext.gettext('Add languages in the order you prefer.'
                                      ' If a translation is not available,'
                                      ' the next in the list will be used.')
        self._text = Gtk.Label(label=explanation)
        self._text.set_line_wrap(True)
        self._text.set_alignment(0, 0)
        self.pack_start(self._text, False, False, 0)
        self._text.show()

        scrolled = Gtk.ScrolledWindow()
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()
        self.pack_start(scrolled, True, True, 0)

        self._table = Gtk.Table(rows=2, columns=4, homogeneous=False)
        self._table.set_border_width(style.DEFAULT_SPACING * 2)
        self._table.show()
        scrolled.add_with_viewport(self._table)

        self._lang_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
        self.pack_start(self._lang_alert_box, False, True, 0)

        self._lang_alert = InlineAlert()
        self._lang_alert_box.pack_start(self._lang_alert, True, True, 0)
        if 'lang' in self.restart_alerts:
            self._lang_alert.props.msg = self.restart_msg
            self._lang_alert.show()
        self._lang_alert_box.show()

        self.setup()
    def effect(self):
        # Main entry

        self.svg = self.document.getroot()
        self.CheckSVGforLUSData()

        #____________	Output to Line-us here   ____________________________________

        if self.options.tab == '"splash"':  # Plot
            self.LU = True
            self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.connect()
            self.allLayers = True
            self.plotCurrentLayer = True
            self.svgNodeCount = 0
            self.svgLastPath = 0
            self.svgLayer = 12345
            # indicate that we are plotting all layers.
            self.plotToLUS()

        elif self.options.tab == '"manual"':
            self.LU = True
            self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.connect()
            self.manualCommand()

        elif self.options.tab == '"layers"':
            self.LU = True
            self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.connect()
            self.allLayers = False
            self.plotCurrentLayer = False
            self.LayersPlotted = 0
            self.svgLastPath = 0
            self.svgNodeCount = 0
            self.svgLayer = self.options.layernumber
            self.plotToLUS()
            if (self.LayersPlotted == 0):
                inkex.errormsg(
                    gettext.gettext(
                        "Did not find any numbered layers to plot."))

        #elif self.options.tab == '"setup"':    #just fict op to have smth to close below
        #self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        #elif self.options.tab == '"options"'':    #just fict op to have smth to close below
        #self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

#____________	Output to G-code file here   ____________________________________

        elif self.options.tab == '"gcode"':  #G-code
            self.GF = True
            self.fil = open(Gcode_file, 'w')
            self.fil.write('G54 X0 Y0 S1\n')  # write header needed for Line-us
            self.allLayers = True
            self.plotCurrentLayer = True
            self.svgNodeCount = 0
            self.svgLastPath = 0
            self.svgLayer = 12345
            # indicate that we are plotting all layers.
            self.plotToLUS()

#____________	Common  final section   ____________________________________

        self.svgDataRead = False
        self.UpdateSVGLUSData(self.svg)

        if self.LU:  #to Line-us
            self._sock.close()
        if self.GF:  #to Gcode file
            self.fil.close()

        self.LU = False
        self.GF = False

        return
Example #36
0
def _(txt):
	t = gettext.dgettext("ZapStatistic", txt)
	if t == txt:
		t = gettext.gettext(txt)
	return t
Example #37
0
 def _(txt):
     if gettext.dgettext(PluginLanguageDomain, txt):
         return gettext.dgettext(PluginLanguageDomain, txt)
     else:
         print(("[%s] fallback to default translation for %s" % (PluginLanguageDomain, txt)))
         return gettext.gettext(txt)
Example #38
0
Name=%s
Exec=%s
Icon=%s
Comment=%s
X-GNOME-Autostart-enabled=true
Hidden=false
Type=Application
"""

portable_mode_enabled = False

if IS_WINDOWS:
    # On Windows, WMI and pywin32 libraries are reqired
    import wmi, _winreg
""" Localization lambdas """
_ = lambda (a): _uc(gettext.gettext(a))
_uc = lambda (b): b if type(b) == unicode else b.decode("utf-8")


def luhn_b32generate(s):
    """
	Returns a check digit for the string s which should be composed of
	characters from LUHN_ALPHABET
	"""
    factor, sum, n = 1, 0, len(LUHN_ALPHABET)
    for c in s:
        try:
            codepoint = LUHN_ALPHABET.index(c)
        except ValueError:
            raise ValueError("Digit %s is not valid" % (c, ))
        addend = factor * codepoint
def TranslateTXT(txt):
    t = gettext.dgettext(PluginLanguageDomain, txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #40
0
#    library.
#    You must obey the GNU General Public License in all respects for all of
#    the code used other than OpenSSL. If you modify file(s) with this
#    exception, you may extend this exception to your version of the file(s),
#    but you are not obligated to do so. If you do not wish to do so, delete
#    this exception statement from your version. If you delete this exception
#    statement from all source files in the program, then also delete it here.
#
#

import zlib
import gettext
from mako.template import Template as MakoTemplate
from deluge import common

_ = lambda x: gettext.gettext(x).decode("utf-8")


def escape(text):
    """
    Used by the gettext.js template to escape translated strings
    so they don't break the script.
    """
    text = text.replace("'", "\\'")
    text = text.replace('\r\n', '\\n')
    text = text.replace('\r', '\\n')
    text = text.replace('\n', '\\n')
    return text


def compress(contents, request):
Example #41
0
def _(txt):
    # pylint: disable-msg=C0103
    t = gettext.dgettext("EmailClient", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #42
0
import gettext

from sugar3.graphics import style
from sugar3.graphics.icon import Icon

from sugar3.graphics.palettemenu import PaletteMenuItem

from jarabe.controlpanel.sectionview import SectionView
from jarabe.controlpanel.inlinealert import InlineAlert

_translate_language = lambda msg: gettext.dgettext('iso_639', msg)
_translate_country = lambda msg: gettext.dgettext('iso_3166', msg)

CLASS = 'Language'
ICON = 'module-language'
TITLE = gettext.gettext('Language')


class Language(SectionView):
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts
        self._lang_sid = 0
        self._selected_lang_count = 0
        self._labels = []
        self._language_dict = {}
        self._country_dict = {}
        self._language_buttons = []
        self._country_buttons = []
    def recursivelyTraverseSvg(self,
                               aNodeList,
                               matCurrent=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]],
                               parent_visibility='visible'):
        for node in aNodeList:
            # Ignore invisible nodes
            v = node.get('visibility', parent_visibility)
            if v == 'inherit':
                v = parent_visibility
            if v == 'hidden' or v == 'collapse':
                pass

            # first apply the current matrix transform to this node's tranform
            matNew = composeTransform(matCurrent,
                                      parseTransform(node.get("transform")))

            if node.tag == inkex.addNS('g', 'svg') or node.tag == 'g':
                #self.penUp()

                if (node.get(inkex.addNS('groupmode', 'inkscape')) == 'layer'):
                    if not self.allLayers:
                        #inkex.errormsg('Plotting layer named: ' + node.get(inkex.addNS('label', 'inkscape')))
                        self.DoWePlotLayer(
                            node.get(inkex.addNS('label', 'inkscape')))
                self.recursivelyTraverseSvg(node, matNew, parent_visibility=v)

            elif node.tag == inkex.addNS('use', 'svg') or node.tag == 'use':

                # A <use> element refers to another SVG element via an xlink:href="#blah"
                # attribute.  We will handle the element by doing an XPath search through
                # the document, looking for the element with the matching id="blah"
                # attribute.  We then recursively process that element after applying
                # any necessary (x,y) translation.
                #
                # Notes:
                #  1. We ignore the height and width attributes as they do not apply to
                #     path-like elements, and
                #  2. Even if the use element has visibility="hidden", SVG still calls
                #     for processing the referenced element.  The referenced element is
                #     hidden only if its visibility is "inherit" or "hidden".

                refid = node.get(inkex.addNS('href', 'xlink'))
                if refid:
                    # [1:] to ignore leading '#' in reference
                    path = '//*[@id="%s"]' % refid[1:]
                    refnode = node.xpath(path)
                    if refnode:
                        x = float(node.get('x', '0'))
                        y = float(node.get('y', '0'))
                        # Note: the transform has already been applied
                        if (x != 0) or (y != 0):
                            matNew2 = composeTransform(
                                matNew,
                                parseTransform('translate(%f,%f)' % (x, y)))
                        else:
                            matNew2 = matNew
                        v = node.get('visibility', v)
                        self.recursivelyTraverseSvg(refnode,
                                                    matNew2,
                                                    parent_visibility=v)
                    else:
                        pass
                else:
                    pass

            elif node.tag == inkex.addNS('path', 'svg'):

                self.pathcount += 1
                self.plotPath(node, matNew)
                self.svgLastPath += 1
                self.svgLastPathNC = self.nodeCount

            elif node.tag == inkex.addNS('rect', 'svg') or node.tag == 'rect':

                # Manually transform
                #
                #    <rect x="X" y="Y" width="W" height="H"/>
                #
                # into
                #
                #    <path d="MX,Y lW,0 l0,H l-W,0 z"/>
                #
                # I.e., explicitly draw three sides of the rectangle and the
                # fourth side implicitly

                # Create a path with the outline of the rectangle
                newpath = inkex.etree.Element(inkex.addNS('path', 'svg'))
                x = float(node.get('x'))
                y = float(node.get('y'))
                w = float(node.get('width'))
                h = float(node.get('height'))
                s = node.get('style')
                if s:
                    newpath.set('style', s)
                t = node.get('transform')
                if t:
                    newpath.set('transform', t)
                a = []
                a.append(['M ', [x, y]])
                a.append([' l ', [w, 0]])
                a.append([' l ', [0, h]])
                a.append([' l ', [-w, 0]])
                a.append([' Z', []])
                newpath.set('d', simplepath.formatPath(a))
                self.plotPath(newpath, matNew)

            elif node.tag == inkex.addNS('line', 'svg') or node.tag == 'line':

                # Convert
                #
                #   <line x1="X1" y1="Y1" x2="X2" y2="Y2/>
                #
                # to
                #
                #   <path d="MX1,Y1 LX2,Y2"/>

                self.pathcount += 1

                # Create a path to contain the line
                newpath = inkex.etree.Element(inkex.addNS('path', 'svg'))
                x1 = float(node.get('x1'))
                y1 = float(node.get('y1'))
                x2 = float(node.get('x2'))
                y2 = float(node.get('y2'))
                s = node.get('style')
                if s:
                    newpath.set('style', s)
                t = node.get('transform')
                if t:
                    newpath.set('transform', t)
                a = []
                a.append(['M ', [x1, y1]])
                a.append([' L ', [x2, y2]])
                newpath.set('d', simplepath.formatPath(a))
                self.plotPath(newpath, matNew)
                self.svgLastPath += 1
                self.svgLastPathNC = self.nodeCount

            elif node.tag == inkex.addNS('polyline',
                                         'svg') or node.tag == 'polyline':

                # Convert
                #
                #  <polyline points="x1,y1 x2,y2 x3,y3 [...]"/>
                #
                # to
                #
                #   <path d="Mx1,y1 Lx2,y2 Lx3,y3 [...]"/>
                #
                # Note: we ignore polylines with no points

                pl = node.get('points', '').strip()
                if pl == '':
                    pass

                self.pathcount += 1

                pa = pl.split()
                if not len(pa):
                    pass
                # Issue 29: pre 2.5.? versions of Python do not have
                #    "statement-1 if expression-1 else statement-2"
                # which came out of PEP 308, Conditional Expressions
                #d = "".join( ["M " + pa[i] if i == 0 else " L " + pa[i] for i in range( 0, len( pa ) )] )
                d = "M " + pa[0]
                for i in range(1, len(pa)):
                    d += " L " + pa[i]
                newpath = inkex.etree.Element(inkex.addNS('path', 'svg'))
                newpath.set('d', d)
                s = node.get('style')
                if s:
                    newpath.set('style', s)
                t = node.get('transform')
                if t:
                    newpath.set('transform', t)
                self.plotPath(newpath, matNew)
                self.svgLastPath += 1
                self.svgLastPathNC = self.nodeCount

            elif node.tag == inkex.addNS('polygon',
                                         'svg') or node.tag == 'polygon':

                # Convert
                #
                #  <polygon points="x1,y1 x2,y2 x3,y3 [...]"/>
                #
                # to
                #
                #   <path d="Mx1,y1 Lx2,y2 Lx3,y3 [...] Z"/>
                #
                # Note: we ignore polygons with no points

                pl = node.get('points', '').strip()
                if pl == '':
                    pass

                self.pathcount += 1

                pa = pl.split()
                if not len(pa):
                    pass
                # Issue 29: pre 2.5.? versions of Python do not have
                #    "statement-1 if expression-1 else statement-2"
                # which came out of PEP 308, Conditional Expressions
                #d = "".join( ["M " + pa[i] if i == 0 else " L " + pa[i] for i in range( 0, len( pa ) )] )
                d = "M " + pa[0]
                for i in range(1, len(pa)):
                    d += " L " + pa[i]
                d += " Z"
                newpath = inkex.etree.Element(inkex.addNS('path', 'svg'))
                newpath.set('d', d)
                s = node.get('style')
                if s:
                    newpath.set('style', s)
                t = node.get('transform')
                if t:
                    newpath.set('transform', t)
                self.plotPath(newpath, matNew)
                self.svgLastPath += 1
                self.svgLastPathNC = self.nodeCount

            elif node.tag == inkex.addNS( 'ellipse', 'svg' ) or \
             node.tag == 'ellipse' or \
             node.tag == inkex.addNS( 'circle', 'svg' ) or \
             node.tag == 'circle':

                # Convert circles and ellipses to a path with two 180 degree arcs.
                # In general (an ellipse), we convert
                #
                #   <ellipse rx="RX" ry="RY" cx="X" cy="Y"/>
                #
                # to
                #
                #   <path d="MX1,CY A RX,RY 0 1 0 X2,CY A RX,RY 0 1 0 X1,CY"/>
                #
                # where
                #
                #   X1 = CX - RX
                #   X2 = CX + RX
                #
                # Note: ellipses or circles with a radius attribute of value 0 are ignored

                if node.tag == inkex.addNS('ellipse',
                                           'svg') or node.tag == 'ellipse':
                    rx = float(node.get('rx', '0'))
                    ry = float(node.get('ry', '0'))
                else:
                    rx = float(node.get('r', '0'))
                    ry = rx
                if rx == 0 or ry == 0:
                    pass

                self.pathcount += 1

                cx = float(node.get('cx', '0'))
                cy = float(node.get('cy', '0'))
                x1 = cx - rx
                x2 = cx + rx
                d = 'M %f,%f ' % ( x1, cy ) + \
                 'A %f,%f ' % ( rx, ry ) + \
                 '0 1 0 %f,%f ' % ( x2, cy ) + \
                 'A %f,%f ' % ( rx, ry ) + \
                 '0 1 0 %f,%f' % ( x1, cy )
                newpath = inkex.etree.Element(inkex.addNS('path', 'svg'))
                newpath.set('d', d)
                s = node.get('style')
                if s:
                    newpath.set('style', s)
                t = node.get('transform')
                if t:
                    newpath.set('transform', t)
                self.plotPath(newpath, matNew)
                self.svgLastPath += 1
                self.svgLastPathNC = self.nodeCount
            elif node.tag == inkex.addNS('metadata',
                                         'svg') or node.tag == 'metadata':
                pass
            elif node.tag == inkex.addNS('defs', 'svg') or node.tag == 'defs':
                pass
            elif node.tag == inkex.addNS(
                    'namedview', 'sodipodi') or node.tag == 'namedview':
                pass
            elif node.tag == inkex.addNS('lus', 'svg') or node.tag == 'lus':
                pass
            elif node.tag == inkex.addNS('title',
                                         'svg') or node.tag == 'title':
                pass
            elif node.tag == inkex.addNS('desc', 'svg') or node.tag == 'desc':
                pass
            elif node.tag == inkex.addNS('text', 'svg') or node.tag == 'text':
                if not self.warnings.has_key('text'):
                    inkex.errormsg(
                        gettext.gettext(
                            'Warning: unable to draw text; ' +
                            'please convert it to a path first.  Consider using the '
                            +
                            'Hershey Text extension which is located under the '
                            + '"Render" category of extensions.'))
                    self.warnings['text'] = 1
                pass
            elif node.tag == inkex.addNS('image',
                                         'svg') or node.tag == 'image':
                if not self.warnings.has_key('image'):
                    inkex.errormsg(
                        gettext.gettext(
                            'Warning: unable to draw bitmap images; ' +
                            'please convert them to line art first.  Consider using the "Trace bitmap..." '
                            +
                            'tool of the "Path" menu.  Mac users please note that some X11 settings may '
                            +
                            'cause cut-and-paste operations to paste in bitmap copies.'
                        ))
                    self.warnings['image'] = 1
                pass
            elif node.tag == inkex.addNS('pattern',
                                         'svg') or node.tag == 'pattern':
                pass
            elif node.tag == inkex.addNS(
                    'radialGradient', 'svg') or node.tag == 'radialGradient':
                # Similar to pattern
                pass
            elif node.tag == inkex.addNS(
                    'linearGradient', 'svg') or node.tag == 'linearGradient':
                # Similar in pattern
                pass
            elif node.tag == inkex.addNS('style',
                                         'svg') or node.tag == 'style':
                # This is a reference to an external style sheet and not the value
                # of a style attribute to be inherited by child elements
                pass
            elif node.tag == inkex.addNS('cursor',
                                         'svg') or node.tag == 'cursor':
                pass
            elif node.tag == inkex.addNS('color-profile',
                                         'svg') or node.tag == 'color-profile':
                # Gamma curves, color temp, etc. are not relevant to single color output
                pass
            elif not isinstance(node.tag, basestring):
                # This is likely an XML processing instruction such as an XML
                # comment.  lxml uses a function reference for such node tags
                # and as such the node tag is likely not a printable string.
                # Further, converting it to a printable string likely won't
                # be very useful.
                pass
            else:
                if not self.warnings.has_key(str(node.tag)):
                    t = str(node.tag).split('}')
                    inkex.errormsg(
                        gettext.gettext(
                            'Warning: unable to draw <' + str(t[-1]) +
                            '> object, please convert it to a path first.'))
                    self.warnings[str(node.tag)] = 1
                pass
Example #44
0
def _(txt):
    t = gettext.dgettext("KravenHD", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #45
0
def _(txt):
    if gettext.dgettext(PluginLanguageDomain, txt):
        return gettext.dgettext(PluginLanguageDomain, txt)
    else:
        return gettext.gettext(txt)
Example #46
0
def _(txt):
    if gettext.dgettext(PluginLanguageDomain, txt):
        return gettext.dgettext(PluginLanguageDomain, txt)
    else:
        print "[" + PluginLanguageDomain + "] fallback to default translation for " + txt
        return gettext.gettext(txt)
Example #47
0
def _(txt):
	t = gettext.dgettext("PackageManager", txt)
	if t == txt:
		t = gettext.gettext(txt)
	return t
Example #48
0
SEARCH_RESULTS_RETURNED = counters.PerfCounter(
    'gcb-search-results-returned',
    'The number of search results returned across all student queries.')
SEARCH_FAILURES = counters.PerfCounter(
    'gcb-search-failures',
    'The number of search failure messages returned across all student '
    'queries.')

INDEX_NAME = 'gcb_search_index'
RESULTS_LIMIT = 10
GCB_SEARCH_FOLDER_NAME = os.path.normpath('/modules/search/')

MAX_RETRIES = 5

# I18N: Message displayed on search results page when error occurs.
SEARCH_ERROR_TEXT = gettext.gettext('Search is currently unavailable.')


class ModuleDisabledException(Exception):
    """Exception thrown when the search module is disabled."""
    pass


def get_index(course):
    return search.Index(name=INDEX_NAME,
                        namespace=course.app_context.get_namespace_name())


def index_all_docs(course, incremental):
    """Index all of the docs for a given models.Course object.
Example #49
0
def _(txt):
    t = gettext.dgettext("XTPanel", txt)
    if t == txt:
        print "[XTPanel] fallback to default translation for", txt
        t = gettext.gettext(txt)
    return t
Example #50
0
def translate(string):
    if _current_translator:
        return _current_translator.gettext(string)
    return gettext.gettext(string)
def _(txt):
    t = gettext.dgettext('MyMetrix', txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #52
0
def _(txt):
    t = gettext.dgettext("mySettings", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #53
0
def _(txt):
    t = dgettext("HddManager", txt)
    if t == txt:
        t = gettext(txt)
    return t
Example #54
0
def _(txt):
    t = gettext.dgettext(myPlugin, txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #55
0
def translate_yavdr(text):
    gettext.textdomain('yavdr')
    try:
        return to_text(gettext.gettext(text))
    except:
        return to_text(text)
Example #56
0
def _(txt):
    t = gettext.dgettext("EPGSearch", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #57
0
def _(txt):
    t = gettext.dgettext(PluginLanguageDomain, txt)
    if t == txt:
        #print "[%s] fallback to default translation for %s" % (PluginLanguageDomain, txt)
        t = gettext.gettext(txt)
    return t
Example #58
0
def _(txt):
    t = gettext.dgettext("Volume_adjust", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t
Example #59
0
def _(txt):
	t = gettext.dgettext("Podcast", txt)
	if t == txt:
		t = gettext.gettext(txt)
	return t
Example #60
0
 def add_addon_handler(self, plugin, func, label, desc, args, package,
                       media):
     """Registers addon service description."""
     self.plugins[plugin].handler[func] = AddonService(
         func, gettext(label), gettext(desc), args, package, media)