Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 40 additions & 15 deletions src/NetworkStatus.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@

import gi
import os

gi.require_version("NM", "1.0")
from gi.repository import NM

def isMobileData():
""" Return True if not on Wifi and potentially on metered 4g/phone connection """
isMobile = True
client = NM.Client.new(None)
devices = client.get_all_devices()
for device in devices:
if device.is_real() and device.get_state() == NM.DeviceState.ACTIVATED:
if type(device) == NM.DeviceEthernet:
try:
gi.require_version("NM", "1.0")
from gi.repository import NMi

def isMobileData():
""" Return True if not on Wifi and potentially on metered 4g/phone connection """
isMobile = True
client = NM.Client.new(None)
devices = client.get_all_devices()
for device in devices:
if device.is_real() and device.get_state() == NM.DeviceState.ACTIVATED:
if type(device) == NM.DeviceEthernet:
isMobile = False
if type(device) == NM.DeviceWifi:
isMobile = False
return isMobile

if __name__ == '__main__':
print('Mobile data status: %s' % (isMobileData(), ))

except (ImportError, ValueError) as err:

def get_active_interfaces():
net_path = "/sys/class/net"
active = []
for iface in os.listdir(net_path):
operstate = f"{net_path}/{iface}/operstate"
if os.path.exists(operstate):
with open(operstate) as f:
if f.read().strip() == "up":
active.append(iface)
return active

def isMobileData():
isMobile = True
for iface in get_active_interfaces():
if iface.startswith(("wlan", "wl")):
isMobile = False
if type(device) == NM.DeviceWifi:
elif iface.startswith(("eth", "en")):
isMobile = False
return isMobile
return isMobile

if __name__ == '__main__':
print('Mobile data status: %s' % (isMobileData(), ))
15 changes: 15 additions & 0 deletions src/SettingsDialog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import gi
import os
import urllib
import locale
import pathlib
import locale

localedir = pathlib.Path(__file__).resolve().parent / 'lang'
locale.bindtextdomain('repeaterstart', localedir)
locale.textdomain('repeaterstart')

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
Expand All @@ -9,6 +16,7 @@
from CsvRepeaterListing import CsvRepeaterListing
from RepeaterStartCommon import userFile
from urllib.error import HTTPError
import pathlib

class SettingsDialog:
def __init__(self, parentWin):
Expand Down Expand Up @@ -92,6 +100,13 @@ def getShown(self):
def show(self):
#Create GtkDialog
self.builder = Gtk.Builder()
domain = 'repeaterstart'
localepath= os.path.dirname(__file__)+'/lang'
locale.bindtextdomain(domain , localepath )
#locale.textdomain(domain)
#locale.setlocale(locale.LC_ALL,'')
self.builder.set_translation_domain(domain )
locale.textdomain('repeaterstart')
self.builder.add_from_file('SettingsDialog.glade')
self.builder.connect_signals(self)
self.dialog = self.builder.get_object('SettingsDialog')
Expand Down
Binary file added src/lang/es/LC_MESSAGES/repeaterstart.mo
Binary file not shown.
90 changes: 90 additions & 0 deletions src/lang/es/LC_MESSAGES/repeaterstart.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-12 23:08-0700\n"
"PO-Revision-Date: 2026-04-12 23:15-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0.1\n"

# Translations
msgid "Add Repeater"
msgstr "Anadir repitador"

msgid "Cache"
msgstr "Caché"

msgid "Back"
msgstr "Atrás"

msgid "Find my location"
msgstr "Encontrar mi ubicación"

msgid "Radio Setup Help"
msgstr "Ayuda de configuración de radio"

msgid "Go premium!"
msgstr "Comprar premium!"

msgid "_Goto IRLP Status page"
msgstr "Ir a la página de IRLP"

msgid "Comment"
msgstr "Comentar"

msgid "Map Center:"
msgstr "Centro de mapas:"

msgid "(Repeaters filtered in settings)"
msgstr "(Repetidores filtrados en la configuración)"

msgid "_Goto Repeater Page"
msgstr "Ir a la página de repitador"

msgid "Frequency Filter"
msgstr "Filtro de frecuencia"

msgid "Units"
msgstr "Unidades"

msgid "Allow download away from wired/wifi"
msgstr "Permitir la descarga fuera de cable/wifi"

msgid "Background Downloads"
msgstr "Descargas en segundo plano"

msgid "There is an update available. Do you wish to install it?"
msgstr "Hay un actualizaction disponsible. Te gusta installar?"

#: SettingsDialog.glade:26
msgid "Close"
msgstr "Cerrar"

msgid "Show All"
msgstr "Mostrar todo"

msgid "Custom:"
msgstr "Otra:"

#: SettingsDialog.glade:140
msgid "Show only "
msgstr "Mostrar solo "

msgid "Miles"
msgstr "Millas"

msgid "Kilometers"
msgstr "Kilómetros"

msgid "Displayed repeaters"
msgstr "Repetidores mostrados"
49 changes: 34 additions & 15 deletions src/repeaterstart.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@
import random
import subprocess
import json
import gettext
import locale
import pathlib

localedir = pathlib.Path(__file__).resolve().parent / 'lang'
espanol = gettext.translation('repeaterstart', localedir=localedir, languages=['es'])
locale.textdomain('repeaterstart')
if os.environ.get('LANG', '')[:2] == 'es':
lang = gettext.translation('repeaterstart', localedir=localedir, languages=['es'])
else:
lang = gettext.NullTranslations()
lang.install()
__ = lang.gettext

localedir_str = str(localedir)
gettext.bindtextdomain('repeaterstart', localedir_str)
locale.bindtextdomain('repeaterstart', localedir_str)

import gi
gi.require_version("Gtk", "3.0")
Expand Down Expand Up @@ -94,7 +111,7 @@ def run(self):
self.finished = True
self.success = True
except urllib.error.URLError:
print("offline?")
print("offline? Could not get "+self.url)
self.finished = True
except urllib.error.HTTPError:
print("Failed to fetch.")
Expand Down Expand Up @@ -190,7 +207,7 @@ def __init__(self):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale('locateme.svg',width=21,height=21,preserve_aspect_ratio=True)
GoImg = Gtk.Image.new_from_pixbuf(pixbuf)
home_button.set_image(GoImg)
home_button.set_tooltip_text('Find my location')
home_button.set_tooltip_text(__('Find my location'))
search_button = Gtk.Button()
search_button.set_image(Gtk.Image(icon_name='edit-find',
icon_size=Gtk.IconSize.LARGE_TOOLBAR))
Expand All @@ -214,18 +231,20 @@ def __init__(self):


home_button.connect('clicked', self.home_clicked)
self.back_button = Gtk.Button(stock=Gtk.STOCK_GO_BACK)

self.back_button = Gtk.Button(label=__('Back'))
self.back_button.set_image(Gtk.Image.new_from_icon_name('go-previous', Gtk.IconSize.BUTTON))
self.back_button.connect('clicked', self.back_clicked)

self.cache_button = Gtk.Button('Cache')
self.cache_button = Gtk.Button(__('Cache'))
self.cache_button.connect('clicked', self.cache_clicked)
if self.mainScreen.get_width() < 800:
#Just room for icon on Librem/phone.
self.add_button = Gtk.Button()
self.add_button.set_image(Gtk.Image(icon_name="list-add",
icon_size=Gtk.IconSize.LARGE_TOOLBAR))
else:
self.add_button = Gtk.Button('Add Repeater')
self.add_button = Gtk.Button(__('Add Repeater'))
self.add_button.connect('clicked', self.add_repeater_clicked)

overlay = Gtk.Overlay()
Expand All @@ -242,7 +261,7 @@ def __init__(self):
pro_container = Gtk.HBox()
pro_inner = Gtk.VBox()
pro_inner.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(1.0, 1.0, 0.8, 1.0))
pro = Gtk.Label("Go premium!", xalign=1)
pro = Gtk.Label(__("Go premium!"), xalign=1)
pro.set_has_window(True)
pro.set_events(Gdk.EventMask.BUTTON_PRESS_MASK)
pro.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0.9, 0.0, 0.0, 1.0))
Expand Down Expand Up @@ -345,12 +364,12 @@ def buttonPress(self,listbox, event):
if listBoxRow.repeaterID>0:
rcgoto.connect("activate", self.followlink)
rcgoto.repeaterID = listBoxRow.repeaterID
rcgoto.set_label("_Goto Repeater Page")
rcgoto.set_label(__("_Goto Repeater Page"))
rcgoto.show()
rccomment = Gtk.ImageMenuItem.new()
rccomment.connect("activate", self.followcommentlink)
rccomment.repeaterID = listBoxRow.repeaterID
rccomment.set_label("Comment")
rccomment.set_label(__("Comment"))
rccomment.show()
rcmenu.append(rcgoto)
rcmenu.append(rccomment)
Expand All @@ -366,7 +385,7 @@ def buttonPress(self,listbox, event):
elif int(listBoxRow.irlp)>0:
rcgoto.connect("activate", self.followIRLPlink)
rcgoto.irlp = listBoxRow.irlp
rcgoto.set_label("_Goto IRLP Status page")
rcgoto.set_label(__("_Goto IRLP Status page"))
rcgoto.show()
rcmenu.append(rcgoto)
else:
Expand Down Expand Up @@ -546,7 +565,7 @@ def updateMessage(self):
dlg = Gtk.MessageDialog(self,
0,Gtk.MessageType.QUESTION,
Gtk.ButtonsType.YES_NO,
'There is an update available. Do you wish to install it?\n'+
__('There is an update available. Do you wish to install it?')+'\n'+
updateinfo['message'])
response = dlg.run()
if response == Gtk.ResponseType.YES:
Expand Down Expand Up @@ -800,7 +819,7 @@ def privacySettingsOpen(self):
dlg = Gtk.MessageDialog(self,
0,Gtk.MessageType.WARNING,
Gtk.ButtonsType.OK,
'Please allow geolocation to use this feature.')
__('Please allow geolocation to use this feature.'))
response = dlg.run()
dlg.destroy()
subprocess.Popen(['gnome-control-center','privacy'])
Expand Down Expand Up @@ -845,9 +864,9 @@ def on_map_change(self, event):
self.renderedLon = self.osm.props.longitude

t = time.time()
text = 'Map Center: %s, latitude %s longitude %s' if self.mainScreen.get_width() > 800 else '%s, lat: %s lon: %s'
text = __('Map Center:')+' %s, latitude %s longitude %s' if self.mainScreen.get_width() > 800 else '%s, lat: %s lon: %s'
if self.settingsDialog.getMinFilter()>-1 or self.settingsDialog.getMaxFilter()<1E99:
text += ' (Repeaters filtered in settings)'
text += ' '+__('(Repeaters filtered in settings)')
self.latlon_entry.set_text(
text % (
latLongToLocator(self.renderedLat, self.renderedLon),
Expand Down Expand Up @@ -973,7 +992,7 @@ def addToList(self, repeater, lat, lon):
helpbtn.repeater = repeater;
helpbtn.set_image(Gtk.Image(icon_name='help-browser',
icon_size=self.PLAYSIZE))
helpbtn.set_tooltip_text('Radio Setup Help')
helpbtn.set_tooltip_text(__('Radio Setup Help'))
helpbtn.connect('clicked', self.helppro)
playbtn.connect('clicked', self.playpause)
rightbox = Gtk.VBox()
Expand Down Expand Up @@ -1041,7 +1060,7 @@ def helppro(self, el):
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.MessageType.QUESTION,
Gtk.ButtonsType.OK_CANCEL,
"Enter your License key for quick, step by step repeater programming instructions.")
__("Enter your License key for quick, step by step repeater programming instructions.") )
dialogBox = dialogWindow.get_content_area()
userEntry = Gtk.Entry()
userEntry.set_size_request(60,12);
Expand Down