GithubHelp home page GithubHelp logo

mmmzzzz / nextion2text Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 17.0 837 KB

Converts a Nextion HMI file to Text files. Allows f.ex. to see changes in commit diffs.

License: Mozilla Public License 2.0

Python 99.82% Batchfile 0.18%

nextion2text's People

Contributors

jobr99 avatar kant avatar mmmzzzz avatar phibue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nextion2text's Issues

Change a component property in a .page file?

Is it possible to do the reverse-- change the property of a component in a .page file? Such as its height, width, color, or position.

I'm not sure if there are CRC's or other things in place to prevent this.

Number Bug

Numerical properties sometimes show a wrong value in der text file. For example the value of a Number is 2200. In the text file I get "Initial Value: 2780". For most other values it is working fine.

Problems when using file generated by Nextion editor 0.53

This error occurs

Traceback (most recent call last):
File "C:\Users\fredrik\OneDrive\Dokument\Nextion2Text-master\Nextion2Text.py", line 1744, in
hmi = HMI(hmiFile)
File "C:\Users\fredrik\OneDrive\Dokument\Nextion2Text-master\Nextion2Text.py", line 1605, in init
self.header = HMIHeader(self.raw)
File "C:\Users\fredrik\OneDrive\Dokument\Nextion2Text-master\Nextion2Text.py", line 1413, in init
self._processData(self.__getHeaderData())
File "C:\Users\fredrik\OneDrive\Dokument\Nextion2Text-master\Nextion2Text.py", line 1500, in _processData
obj = HMIContentHeader(self._raw, index)
File "C:\Users\fredrik\OneDrive\Dokument\Nextion2Text-master\Nextion2Text.py", line 1413, in init
self._processData(self.__getHeaderData())
File "C:\Users\fredrik\OneDrive\Dokument\Nextion2Text-master\Nextion2Text.py", line 1416, in __getHeaderData
return struct.unpack(self._headerFormat, self._raw[self._headerStart:self._headerStart+self.headerSize])
struct.error: unpack requires a buffer of 28 bytes

utf-8 character encoding

I have a project with utf-8 character encoding, because this is the only way to get Chinese characters working.
For example, I have a text element with the following txt string:
Gerät Code|Code|Code|Codice|Código|Kod|代码

Using Nextion2Text.py, I get the following output in the cmd window:

Traceback (most recent call last):
File "D:\Projekte\NextionTest\Nextion2Text.py", line 1851, in
f.write(text)
File "C:\Program Files\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x81' in position 5744: character maps to

I would greatly appreciate any help. Thanks!

Status output order inconsistent

The Status output on stdout and -s option, the order of the output is inconsistent. This doesn't help in diffing versions.
Is there a way to get sorted output?

BTW. I've made a bash script and necessary config adaptations to use this with git (tested only on git-gui for Windows from git-scm.com)

Problem with nextion2text

Traceback (most recent call last):
File "D:\Nextion2Text.py", line 1791, in
text = page.getText(emptyLinesLimit=1, includeUnknown=includeUnknown,
File "D:\Nextion2Text.py", line 1550, in getText
return "".join(self.getTextLines(*args, **kwargs))
File "D:\Nextion2Text.py", line 1542, in getTextLines
comps = sorted(self.components, key=key)
File "D:\Nextion2Text.py", line 1508, in
defaultTextSort = lambda c: Page._defaultSortList.index(c.rawData["att"]["type"])
ValueError: 5 is not in list

'mbcs' codec can't decode bytes in position

Windows 10 x64 (UTF8 experimental support enabled)

Nextion editor V1.62.2
Device: NX4832T035_011
Command: python ./nextion2text/Nextion2Text.py -i ./HMI_FILE.hmi -o ./sources

Traceback (most recent call last):
  File "nextion2text\Nextion2Text.py", line 1750, in <module>
    hmi = HMI(hmiFile)
  File "nextion2text\Nextion2Text.py", line 1611, in __init__
    self.header = HMIHeader(self.raw)
  File "nextion2text\Nextion2Text.py", line 1419, in __init__
    self._processData(self.__getHeaderData())
  File "nextion2text\Nextion2Text.py", line 1506, in _processData
    obj = HMIContentHeader(self._raw, index)
  File "nextion2text\Nextion2Text.py", line 1419, in __init__
    self._processData(self.__getHeaderData())
  File "nextion2text\Nextion2Text.py", line 1477, in _processData
    self.name    = data[0].decode("ansi").rstrip("\x00")
  File "G:\LangAndCompilers\Python\Python3\lib\encodings\mbcs.py", line 21, in decode
    return mbcs_decode(input, errors, True)
UnicodeDecodeError: 'mbcs' codec can't decode bytes in position 0--1: No mapping for the Unicode character exists in the target code page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.