Skip to content

Commit

Permalink
added prints in main_chat for logging what happens when d-rats receiv…
Browse files Browse the repository at this point in the history
…e a mneh chat message and apply filters
  • Loading branch information
maurizioandreotti committed Jun 6, 2020
1 parent 274b613 commit 849d818
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 59 deletions.
42 changes: 1 addition & 41 deletions d_rats/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,47 +174,7 @@
"delete_from" : "",
"remote_admin_passwd" : "",
"expire_stations" : "60",
#FIXME - for any reason these lines are not loaded as default config in the ports section
"ports" : { #"ports_0" : "True,net:ref.d-rats.com:9000,,True,True,RAT",
"ports_1" : "False,net:127.0.0.1:14550,,True,False,APRS (on Localhost)",
"ports_2" : "False,net:dcs007.xreflector.net:9000,,True,False,EUROPE Netherlands",
"ports_3" : "False,/dev/ttyUSB0,9600,True,True,IC2820 ttyUSB0",
"ports_4" : "False,COM1,38400,True,True,ICOM E-92D COM1",
"ports_5" : "False,COM2,9600,True,True,ICOM ID-51 COM2",
"ports_6" : "False,net:w5sf.ratflector.com:9000,,True,False,MEXICO",
"ports_7" : "False,net:localhost:9000,,False,False,My RAT flector (on localhost)",
"ports_8" : "False,net:n1kxj.ddns.net:9000,,True,False,New Englad",
"ports_9" : "False,net:52.87.128.252:9000,,True,False,North Carolina ARES",
"ports_10" : "False,net:pldares.ratflector.com:9000,,True,False,PAULDIN",
"ports_11" : "False,net:sewx.ratflector.com:9000,,True,False,SE WX Net",
"ports_12" : "False,net:hs0zer.no-ip.com:9000,,True,False,THAILAND Bangkok",
"ports_13" : "False,net:alabama.ratflector.com:9000,,True,False,USA ALABAMA",
"ports_14" : "False,net:drats.auburn.edu:9000,,True,False,USA Alabama Statewide ARES",
"ports_15" : "False,net:cfl.ratflector.net:9000,,True,False,USA Central Florida",
"ports_16" : "False,net:ae5he.ratflector.com:9000,,True,False,USA EL PASO",
"ports_17" : "False,net:wa7fw.dstargateway.org:9000,,True,False,USA Federal Way WA",
"ports_18" : "False,net:gaares.ratflector.com:9000,,True,False,USA GAARES",
"ports_19" : "False,net:drats.gaares.org:9000,,True,False,USA Georgia Statewide ARES",
"ports_20" : "False,net:gwinnettares.dyndns.org:9000,,True,False,USA Gwinnett Co ARES",
"ports_21" : "False,net:w5mpz.org:9000,,True,False,USA NEW MEXICO Albuquerque",
"ports_22" : "False,net:nfl.ratflector.net:9000,,True,False,USA Northern Florida",
"ports_23" : "False,net:rat.gaampr.net:9000,,True,False,USA NW GA ARES",
"ports_24" : "False,net:k3pdr.dstargateway.org:9000,,True,False,USA Philadelphia Digital Radio Association (PDRA) K3PDR",
"ports_25" : "False,net:d-rats.wa7dre.org:9000,,True,False,USA Spokane Washington Digital Radio Enthusiasts",
"ports_26" : "False,net:StTammany.ratflector.com:9000,,True,False,USA St. Tammany Parish",
"ports_27" : "False,net:tn.ratflector.com:9000,,True,False,USA TENESSEE",
"ports_28" : "False,net:ducknest.duckdns.org:9000,,True,False,USA Texas - Big Spring",
"ports_29" : "False,net:W5AW.ratflector.com:9000,,True,False,USA TEXAS (W5AW)",
"ports_30" : "False,net:ae5he.ham-radio-op.net:9000,,True,False,USA TEXAS El Paso",
"ports_31" : "False,net:155.98.24.13:9000,,True,False,USA Utah Salt Lake County",
"ports_32" : "False,net:wa7dr.ratflector.com:9000,,True,False,USA WASHINGTON",
"ports_33" : "False,net:gwinnettares.ratflector.com:9000,,True,False,UTAH",
"ports_34" : "False,net:W5SF.ratflector.com:9000,,True,False,W5SF",
"ports_35" : "False,net:n1rcw.ddns.net:9000,,True,False,WX - n1rcw",
"ports_36" : "False,net:dcs007.ratflector.com:9000,,True,False,WX dcs007",
"ports_37" : "False,net:wa7dre.ratflector.com:9000,,True,False,XLX - wa7dre",
},
}
}

_DEF_STATE = {
"main_size_x" : "640",
Expand Down
1 change: 1 addition & 0 deletions d_rats/mainapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ def __chat(self, src, dst, data, incoming, port):
kwargs = {}

if dst != "CQCQCQ":
#so we are messaging into a private channel
to = " -> %s:" % dst
kwargs["priv_src"] = src
else:
Expand Down
14 changes: 7 additions & 7 deletions d_rats/qst.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def do_qst(self):
return str

class QSTWeatherWU(QSTThreadedText):
print("sqt : QSTWeatherWU class retired")
print("Qst : QSTWeatherWU class retired")

class QSTOpenWeather(QSTThreadedText):
def do_qst(self):
Expand All @@ -319,7 +319,7 @@ def do_qst(self):
print(("Qst : Unable to split weather QST %s: %s" % (self.text, e)))
return None

#---to be restore when forecats are done
#---to be restore when forecasts are done
# try:
if t == _("Current"):
url = owuri +"weather?"+ urllib.urlencode({'q': s, 'appid': owappid})
Expand All @@ -343,7 +343,7 @@ def do_qst(self):
wpressure = int(dataJSON['main']['pressure'])
wwindspeed = float(dataJSON['wind']['speed'])

weath = ("Current weather at %s - %s lat: %s Lon: %s \n" % (wname, wcountry, wlat, wlon))
weath = ("\nCurrent weather at %s - %s lat: %s Lon: %s \n" % (wname, wcountry, wlat, wlon))
weath = weath + str("Conditions: %s\n" % wdesc)
weath = weath + str("Current Temperature: %.2f C (%.2f F) \n" % ((wtemp - 273.0),(wtemp*9/5- 459.67)))
weath = weath + str("Minimum Temperature: %.2f C (%.2f F) \n" % ((wtmin - 273.0),(wtmin*9/5- 459.67)))
Expand Down Expand Up @@ -376,7 +376,7 @@ def do_qst(self):
wlon = str(dataJSON['city']['coord']['lon'])


weath = ("Forecast weather for %s - %s lat: %s Lon: %s \n" % (wname, wcountry, wlat, wlon))
weath = ("\nForecast weather for %s - %s lat: %s Lon: %s \n" % (wname, wcountry, wlat, wlon))


# set date to start iterating through
Expand Down Expand Up @@ -451,8 +451,6 @@ def do_qst(self):
#return str(obs)




class QSTStation(QSTGPSA):
def get_source(self, name):
from . import mainapp # Hack to foce mainapp load
Expand Down Expand Up @@ -807,7 +805,7 @@ def _make_controls(self):
lab.show()
hbox.pack_start(lab, 0, 0 , 0)

intervals = ["1", "5", "10", "20", "30", "60", ":30", ":15"]
intervals = ["1", "5", "10", "20", "30", "60", "120", "180", ":30", ":15"]
self._freq = make_choice(intervals, True, default="60")
self._freq.set_size_request(75, -1)
self._freq.show()
Expand Down Expand Up @@ -894,6 +892,8 @@ def get_qst_class(typestr):
}

if not HAVE_FEEDPARSER:
#the HAVE_FEEDPARSER varibale is setup at d-rats launch when it checks if feedparses can be imported
#for any reason feedparser import could fail also if the module is compiled (as it happens in my case on Windows10)
del classes[_("RSS")]

return classes.get(typestr, None)
28 changes: 19 additions & 9 deletions d_rats/ui/main_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _reorder_rows(self, model, path):
iter = model.get_iter_first()
while iter:
msg, = model.get(iter, 0)
print "Setting %i: %s" % (i, msg)
print("Mainchat : Setting %i: %s" % (i, msg))
self._config.set("quick", "msg_%i" % i, msg)
iter = model.iter_next(iter)
i += 1
Expand Down Expand Up @@ -301,7 +301,7 @@ def reconfigure(self):

qc = qst.get_qst_class(t)
if not qc:
print "Error: unable to get QST class `%s'" % t
print("Mainchat : Error : unable to get QST class `%s'" % t)
continue
q = qc(self._config, c, i)
q.connect("qst-fired", self._qst_fired)
Expand Down Expand Up @@ -378,12 +378,18 @@ def _display_for_channel(self, channel):
return None

def _display_line(self, text, apply_filters, *attrs, **kwargs):
print("Mainchat : text: %s " % text)
match = re.match("^([^#].*)(#[^/]+)//(.*)$", text)
print("Mainchat : match: %s " % match)
print("Mainchat : kwargs: %s " % kwargs)
print("Mainchat : apply_filters: %s " % apply_filters)
# print("Mainchat : attrs: %s " % attrs)
#private channel
if "priv_src" in kwargs.keys():
channel = "@%s" % kwargs["priv_src"]
display = self._display_for_channel(channel)
if not display:
print "Creating channel %s" % channel
print("Mainchat : Creating channel %s" % channel)
self._build_filter(channel)
self._save_filters()
display = self._display_for_channel(channel)
Expand All @@ -393,6 +399,7 @@ def _display_line(self, text, apply_filters, *attrs, **kwargs):
display = self._display_for_channel(channel)
elif apply_filters:
display = self._display_matching_filter(text)
print("Mainchat : display: %s " % display)
noticere = self._config.get("prefs", "noticere")
ignorere = self._config.get("prefs", "ignorere")
if noticere and re.search(noticere, text):
Expand Down Expand Up @@ -496,11 +503,12 @@ def _clear(self, but):
display.get_buffer().set_text("")

def _tab_selected(self, tabs, page, num):
#
self._unhighlight_tab(num)


#activate the removefilter button in case we are not on the main chat channel (num!=0)
delf = self._wtree.get_widget("main_menu_delfilter")
delf.set_sensitive(num != 0)

self.__tb_buttons[_("Remove Filter")].set_sensitive(num != 0)

def _tab_reordered(self, tabs, page, num):
Expand Down Expand Up @@ -537,10 +545,12 @@ def _del_filter(self, but):
idx = self.__filtertabs.get_current_page()
page = self.__filtertabs.get_nth_page(idx)
text = self.__filtertabs.get_tab_label(page).get_text()

del self.__filters[text]
self.__filtertabs.remove_page(idx)

print("Mainchat : removing %s " % text)
if (text!= "Main"):
del self.__filters[text]
self.__filtertabs.remove_page(idx)
else:
display_error("Mainchat : Cannot remove Main tab")
self._save_filters()

def _view_log(self, but):
Expand Down
10 changes: 9 additions & 1 deletion d_rats/ui/main_stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ def log_result(job, state, result):
job.set_account(vals[0], vals[1], vals[2], vals[4], vals[3])
job.connect("state-change", log_result)
self.emit("submit-rpc-job", job, port)
elif action == "qrz":
import webbrowser
callsign = station.split("-")
print("mainstat : looking on QRZ.com for %s " % callsign[0])
webbrowser.open('https://www.qrz.com/lookup?callsign=%s' % callsign[0], new=2)


def _make_station_menu(self, station, port):
xml = """
Expand All @@ -258,6 +264,7 @@ def _make_station_menu(self, station, port):
<menuitem action="sendfile"/>
<menuitem action="version"/>
<menuitem action="mcheck"/>
<menuitem action="qrz"/>
<separator/>
<menuitem action="remove"/>
<menuitem action="reset"/>
Expand All @@ -276,7 +283,8 @@ def _make_station_menu(self, station, port):
("remove", _("Remove"), gtk.STOCK_DELETE),
("reset", _("Reset"), gtk.STOCK_JUMP_TO),
("version", _("Get version"), gtk.STOCK_ABOUT),
("mcheck", _("Request mail check"), None)]
("mcheck", _("Request mail check"), None),
("qrz", _("Check on Qrz.com"), None)]

for action, label, stock in actions:
a = gtk.Action(action, label, None, stock)
Expand Down
2 changes: 1 addition & 1 deletion d_rats/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from __future__ import print_function
import sys

DRATS_VERSION = "0.3.9 beta 3 "
DRATS_VERSION = "0.3.9 beta 4 "
DRATS_NAME="d-rats"
DRATS_DESCRIPTION="D-RATS"
DRATS_LONG_DESCRIPTION = "A communications tool for D-STAR"
Expand Down

0 comments on commit 849d818

Please sign in to comment.