And the stupidest thing of all is using configFloat for something that is not a float at all.
Convert an int to configFloat and then convert configFloat back to an int. Absolutely crazy.
Posted 11 October 2016 - 17:38
Edited by littlesat, 11 October 2016 - 17:41.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 11 October 2016 - 18:12
Need adapt "Cable Scan" plugin
+
maybe this
- self.list.append(getConfigListEntry(_('Network ID'), config.plugins.CableScan.networkid)) + self.list.append(getConfigListEntry(_('Network ID') + _(' (0 - all network)'), config.plugins.CableScan.networkid))
GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K
Posted 11 October 2016 - 21:19
Edited by littlesat, 11 October 2016 - 21:23.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 11 October 2016 - 21:24
I think the remark is that the entire code could have been in kHz, in an integer, and just add a dot in the middle for display purposes.
That perhaps would have been simpler, but would require entry in kHz, always, so entering 6 instead of 3 digits for most people. Alternative would be to enter in Mhz as a float, and then directly convert it to integer after input. But that makes the input different from the processing, and isn't exactly clear either.
I think I agree with littlesat that although this is more work, it gives a cleaner end result.
Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)
Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.
Many answers to your question can be found in our new and improved wiki.
Posted 11 October 2016 - 22:01
I think the remark is that the entire code could have been in kHz, in an integer, and just add a dot in the middle for display purposes.
That perhaps would have been simpler, but would require entry in kHz, always, so entering 6 instead of 3 digits for most people.
There is no difference. The display is 6 figures for both. If you don't want to use the last three figure just leave them as zeros. That it the same for both. If the 6 figures are prefilled that is the same for both. Only difference is the UI shows a decimal point and the code is unnecessarily more complicated.
And configFloat isn't even a float, it is 2 integers side by side. The whole thing is completely crazy.
Posted 11 October 2016 - 22:04
class ConfigFloat(ConfigSequence): def __init__(self, default, limits): ConfigSequence.__init__(self, seperator = ".", limits = limits, default = default) def getFloat(self): return float(self.value[1] / float(self.limits[1][1] + 1) + self.value[0]) def getkHz(self): return self.value[0] * 1000 + self.value[1] float = property(getFloat) kHz = property(getkHz)Then:
-compare = [1, self.scan_cab.frequency.value[0]*1000 + self.scan_cab.frequency.value[1], self.scan_cab.symbolrate.value*1000, self.scan_cab.modulation.value, self.scan_cab.fec.value, self.scan_cab.inversion.value, self.scan_cab.system.value] +compare = [1, self.scan_cab.frequency.kHz, self.scan_cab.symbolrate.value*1000, self.scan_cab.modulation.value, self.scan_cab.fec.value, self.scan_cab.inversion.value, self.scan_cab.system.value]Now isn't more clear?
Posted 11 October 2016 - 22:07
I think the remark is that the entire code could have been in kHz, in an integer, and just add a dot in the middle for display purposes.
That perhaps would have been simpler, but would require entry in kHz, always, so entering 6 instead of 3 digits for most people.
There is no difference. The display is 6 figures for both. If you don't want to use the last three figure just leave them as zeros. That it the same for both. If the 6 figures are prefilled that is the same for both. Only difference is the UI shows a decimal point and the code is unnecessarily more complicated.
And configFloat isn't even a float, it is 2 integers side by side. The whole thing is completely crazy.
Hmm... If you put it that way...
Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)
Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.
Many answers to your question can be found in our new and improved wiki.
Posted 11 October 2016 - 22:09
@Athiok,
I would not do that, kHz has nothing to do with ConfigFloat, so that method doesn't belong there. Then it's better to wrap or extend ConfigFloat, or make a Frequency class.
Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)
Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.
Many answers to your question can be found in our new and improved wiki.
Posted 11 October 2016 - 22:11
Edited by athoik, 11 October 2016 - 22:14.
Posted 11 October 2016 - 22:25
I just added something general in the ConfigFloat class...
In this clase you always define the number of digits behind the dot... now I added a property floatint (with setfloatint and getfloatint) that returns an integer of the value times the digits you get...
So basically it returns KHz.... ....
And you can also set it with this property... in KHz.... (as we have 3 digits behind the dot and fill in it as MHz)...
I could not find a better name for the property as floatint.... is indicates it is a float and and integer that keeps all available digits upto what you defined what is behind the dot...
It gives also a very simplified patch.... Just define the ConfigInteger by ConfigFloat and replace the value by floatint....
I did not decide to change the value property because the ConfigFloat class could be used (guaranteed) on other locations and it might break other locations and plugins....
Edited by littlesat, 11 October 2016 - 22:27.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 11 October 2016 - 22:55
Posted 11 October 2016 - 23:12
Then it's better to wrap or extend ConfigFloat, or make a Frequency class.
Lets go for a frequency class that formats the frequency based on a skin parameter.
I did extend the ConfigFloat class... I do not think we need to add a special config class for the DVB-C/T/ATSC frequencies as the float class covers "all"...
Edited by littlesat, 11 October 2016 - 23:15.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 12 October 2016 - 15:24
Yep.... sometimes live is not easy....
I'm still convinced the "." is mandatory....
not for entering the frequency... but having it as it should always be....
Edited by littlesat, 12 October 2016 - 15:27.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
0 members, 2 guests, 0 anonymous users