New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update and enhance date/time facility #138
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Separate VFD dates to a new configuration option - Add an option to disable/hide the VFD date and/or time from the display (Good for people who use their device in a bedroom.) - Add new front panel related ClockToText converter options - Hide EPG based "Timeline 24 Hour" options when new time options are available - Update DisplayText skin to use new parameter format - Use more common strftime() %d format for day of month - Optimise (speed up) ConfigClock editor - Protect the parameter load from crashing and creating a boot loop. IMPORTANT NOTE: Any display skins that user the "<parameter name="AllowUserDatesAndTimesDisplay" value="1" />" must be edited to user the newer form of the parameter "<parameter name="AllowUserDatesAndTimesDisplay" value="1,1" />".
IanSav
referenced
this pull request
Mar 17, 2017
* Allow use of font aliases This change allows skin developers to use font aliases as well as normal fonts in skin based TemplatedMultiContent converter structures. In the past users could only specify fonts in a TemplatedMultiContent converter structure by using the " "fonts": [gFont("Regular",28)] " syntax. With this change users can now also specify font aliases defined in the < fonts > section of the skin as well as the aliases hard coded in skin.py. For example, " "fonts": [parseFont("Body;25")] ". This change should make maintaining skin font management a much easier process. * Add selectable date / time infrastructure [UsageConfig.py] Add date and time formatting options - Include date / time options to support the ClockToText converter and existing coded formats - Include translation hints for new date and time options [setup.xml] Add date and time formatting selection options - The settings in setup.xml appear conditionally. The skin in use must support the new formats before the user will be offered an opportunity to select from the various formats available. - A new < parameter > has been added to the skin to control if the new formats are to be made available to a user. To see the changes edit your skin and add the following < parameter > tag to the < parameters > section of skin.xml: < parameter name="AllowUserDatesAndTimes" value="x,y" / > The setting is granular so that independent control of both the date and time formatting options is available. - If x = 0 then the new date settings will be hidden. - If x = 1 then the new date settings will become available. - If y = 0 then the new time settings will be hidden. - If y = 1 then the new time settings will become available. - Given that most skins do not support the AM/PM times but the new dates appear to work you can start of with: < parameter name="AllowUserDatesAndTimes" value="1,0" / > - If no "AllowUserDatesAndTimes" parameter is found then both the date and time formats will be disabled and the default / classic values enforced. - A Boolean config variable has been added to ease the detection of AM/PM am/pm time formats so that code can determine when more space should be allocated for time display. The config variable is called "config.usage.time.wide". * Group start end times as a tuple [EventTime.py] Add options to group start and end times as a tuple - Remove the incorrectly spelt NextDurartion and ThirdDurartion options that didn't have any code behind them. - Add the correctly spelt NextDuration and ThirdDuration options and add the code to support these options. - The new options Times, NextTimes and ThirdTimes that allow for the start and end times for each of the current, next and third events to be sent out as a single tuple. - This feeds into an enhanced ClockToText converter that recognises the tuple and processes it accordingly. [ClockToText.py] Add ability to recognise a time tuple and output multiple values - Refactor the code to eliminate the masses of "if" blocks. Also shift most of the processing work to be done once in the initialisation block leaving the repeating time display to be much less code intensive. - Remove the hard coded date and time strings and use the new user defined date / time infrastructure. - Add some more useful format options. - Adjust the VFD format from time then date to date then time like all the other formats. - Add new feature to look at the time value being passed to the converter. If it is a tuple then invoke the new looped processing mode. There is a matching update to the "EventTime" converter to supply both the start and end times for an event as a single tuple. If the time is a plain number then process the value as previously. This code change is an enhancement to existing functionality. No skin changes are required to maintain current functionality. - There are three significant benefits of this enhancement: 1) There are many places in the skin where the start time is followed by the end time. These times are separated by a skin based separator character. If the times are blank the separator remains on screen. 2) There is a lot of XML code allocated in the skin to producing the "start - end" time display. This can now be reduced to a single widget. 3) With the separate start time, separator and end time widgets it is difficult toe position and/or align the various strings accurately. By making them a single object they can be accurately positioned and aligned on the screen. - Any time formats for the multiple values can be separately specified and separated by a comma. If there are insufficient formats available for the list of times supplied then the last format will be reused repeatedly until all the time values are displayed. For example, LongFullDate,Default will cause the first time to be formatted as LongFullDate and all other times formatted as Default. An empty format specifier or the commonly used "Default" will mean that all times specified will be formatted as "Default". - A new option Separator is available to specify the string used to join all the time values if multiple times, in a tuple, are supplied. The default is " - ". For example, Separator:- will set the separator to be a single hyphen without spacing. - NOTE: As comma and semicolon are used as the token separator, the default parsing characters are "," or ";", they can not be used in the Format or Separator strings. To allow for the comma or semicolon to be used in a "Format" or "Separator" a new option "Parse" has been created. If used, the "Parse" option must be the FIRST option specified and be immediately followed by the new parse character. For example "Parse|". This would make a modified option line look like "Parse|Default|Separator:, " * Add missing "import locale"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMPORTANT NOTE: Any other display skins that user the "parameter name="<AllowUserDatesAndTimesDisplay" value="1" />" must be edited to user the newer form of the parameter "<parameter name="AllowUserDatesAndTimesDisplay" value="1,1" />". The first value controls the date display while the second value controls the time display.