[chirp_devel] [PATCH 0 of 2] Clone help messages
Marco,
Here's my version of your new feature. It puts the message in an intermediary prompt so that it does not interfere with the clone thread.
If you don't want to see instructions, you can check the box to never see them again. This configuration is global, so you won't have to check it for every radio. We might consider removing the checkbox, forcing Marco to manually edit his conf file to hide the instructions (normal users don't have perfect memory like Marco, and probably don't want to indefinitely hide the instructions).
Dan suggested abstracting this and the experimental prompt into a new Prompts class. I was not feeling that adventurous today, however it is a good idea.
Tom KD7LXL
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1381255994 25200 # Node ID 10b5cfa342621b9094f2079a3ac559c0827a3947 # Parent f7658c8abf415a92aef21c20687ac4e3ee1c89c5 Add instructions for clone mode radios. #1163
diff -r f7658c8abf41 -r 10b5cfa34262 chirpui/mainapp.py --- a/chirpui/mainapp.py Mon Oct 07 09:03:24 2013 -0700 +++ b/chirpui/mainapp.py Tue Oct 08 11:13:14 2013 -0700 @@ -575,6 +575,26 @@ CONF.set_bool(sql_key, not squelch, "state") return resp == gtk.RESPONSE_YES
+ def _show_instructions(self, radio, instructions): + d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) + d.set_markup("<big><b>" + _("{vendor} {model} Instructions").format( + vendor=radio.VENDOR, model=radio.MODEL) + "</b></big>") + msg = _("{instructions}").format(instructions=instructions()) + d.format_secondary_markup(msg) + + again = gtk.CheckButton(_("Don't show this again")) + again.show() + d.vbox.pack_start(again, 0, 0, 0) + d.run() + d.destroy() + CONF.set_bool("clone_instructions", again.get_active(), "noconfirm") + + def _show_download_instructions(self, radio): + return self._show_instructions(radio, radio.get_download_instructions) + + def _show_upload_instructions(self, radio): + return self._show_instructions(radio, radio.get_upload_instructions) + def do_download(self, port=None, rtype=None): d = clone.CloneSettingsDialog(parent=self) settings = d.run() @@ -588,6 +608,9 @@ # User does not want to proceed with experimental driver return
+ if not CONF.get_bool("clone_instructions", "noconfirm"): + self._show_download_instructions(rclass) + print "User selected %s %s on port %s" % (rclass.VENDOR, rclass.MODEL, settings.port) @@ -631,6 +654,9 @@ # User does not want to proceed with experimental driver return
+ if not CONF.get_bool("clone_instructions", "noconfirm"): + self._show_upload_instructions(radio) + try: ser = serial.Serial(port=settings.port, baudrate=radio.BAUD_RATE,
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1381256350 25200 # Node ID 961513dadc611d01f62ce459850b0c8d6ea55ae7 # Parent 10b5cfa342621b9094f2079a3ac559c0827a3947 [ft1802] Add instructions for clone mode. #1163
diff -r 10b5cfa34262 -r 961513dadc61 chirp/ft1802.py --- a/chirp/ft1802.py Tue Oct 08 11:13:14 2013 -0700 +++ b/chirp/ft1802.py Tue Oct 08 11:19:10 2013 -0700 @@ -26,6 +26,7 @@ from chirp import chirp_common, bitwise, directory, yaesu_clone from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean +from textwrap import dedent
MEM_FORMAT = """ #seekto 0x06ea; @@ -88,6 +89,22 @@ _block_lengths = [10, 8001] _memsize = 8011
+ @classmethod + def get_download_instructions(self): + return _(dedent("""\ + 1. Turn radio off. + 2. Connect cable to mic jack. + 3. Press and hold in the [LOW(A/N)] key while turning the radio on. + 4. <b>After clicking OK</b>, press the [MHz(SET)] key to send image.""")) + + @classmethod + def get_upload_instructions(self): + return _(dedent("""\ + 1. Turn radio off. + 2. Connect cable to mic jack. + 3. Press and hold in the [LOW(A/N)] key while turning the radio on. + 4. Press the [D/MR(MW)] key ("--WAIT--" will appear on the LCD).""")) + def get_features(self): rf = chirp_common.RadioFeatures()
participants (1)
-
Tom Hayward