Jump to content
Korean Random
ktulho

Часы и дата (py_macro)

Recommended Posts

17 минут назад, sergbodr сказал:

Странно, часы и дата в квадратики ушли.

проверь шрифт. Если указан $IMELanguageBar - замени на другой. Выпилили его с клиента.

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

@sergbodr в зависимости от конфига. Но если шрифт не указан - в экста полях будет грузиться дефолный $FieldFont. В стандартных будет грузиться стандартный. В любом случае пустых глифов не будет.

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites
3 минуты назад, sergbodr сказал:

а на какой лучше заменить

$FieldFont

Это один и тот же шрифт:

  <alias>
    <embedded>	$FieldFont	</embedded>
    <runtime>	ZurichCond	</runtime>
  </alias>
  <alias>
    <embedded>	$IMELanguageBar	</embedded>
    <runtime>	ZurichCond	</runtime>
  </alias>
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Часы и дата пропали в бою и ангаре евро сервер 

2020-12-26 23:38:33: [INFO]    HTTPS: /4.0/getStatsByNick/ae58d8b9-****-****-****-********8c44/EU/Krasniixxx
2020-12-26 23:38:33: [ERROR] Traceback (most recent call last):
  File "res_mods/mods/xfw_packages\xvm_main\python\python_macro.py", line 165, in process_python_macro
    return (func(), deterministic)
  File "res_mods/mods/xfw_packages\xvm_main\python\python_macro.py", line 158, in <lambda>
    return (lambda: func(*args), deterministic)
  File "res_mods/configs/xvm/py_macro\xvm.py", line 61, in xvm_formatDate
    formatDate = formatDate.decode('utf8').encode(_defaultlocale)
LookupError: unknown encoding: cp65001
arg='xvm.formatDate('%A')'
2020-12-26 23:38:33: [ERROR] Traceback (most recent call last):
  File "res_mods/mods/xfw_packages\xvm_main\python\python_macro.py", line 165, in process_python_macro
    return (func(), deterministic)
  File "res_mods/mods/xfw_packages\xvm_main\python\python_macro.py", line 158, in <lambda>
    return (lambda: func(*args), deterministic)
  File "res_mods/configs/xvm/py_macro\xvm.py", line 61, in xvm_formatDate
    formatDate = formatDate.decode('utf8').encode(_defaultlocale)
LookupError: unknown encoding: cp65001
arg='xvm.formatDate('%H:%M:%S')'
2020-12-26 23:38:33: [ERROR] Traceback (most recent call last):
  File "res_mods/mods/xfw_packages\xvm_main\python\python_macro.py", line 165, in process_python_macro
    return (func(), deterministic)
  File "res_mods/mods/xfw_packages\xvm_main\python\python_macro.py", line 158, in <lambda>
    return (lambda: func(*args), deterministic)
  File "res_mods/configs/xvm/py_macro\xvm.py", line 61, in xvm_formatDate
    formatDa

 

 

xvm.log python.log

Edited by Shumaherxxx
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

@ktulho человек скинул логи с другими модами (не XVM)

 

конструкции:

"{{py:xvm.formatDate('%H{{py:mod({{py:xvm.formatDate('%#S')}},2)=1?:| }}%M')}}" 
"{{py:xvm.formatDate('%A')}}"

ошибки:

2022-09-02 09:17:18: [ERROR] Traceback (most recent call last):
  File "res_mods/mods/xfw_packages\xvm_pymacro\python\__init__.py", line 157, in process
    return (func(), deterministic)
  File "res_mods/mods/xfw_packages\xvm_pymacro\python\__init__.py", line 123, in <lambda>
    return (lambda: func(*args), deterministic)
  File "res_mods/configs/xvm/py_macro\xvm.py", line 61, in xvm_formatDate
    formatDate = formatDate.decode('utf8').encode(_defaultlocale)
LookupError: unknown encoding: cp65001
arg='xvm.formatDate('%d.%m.%Y')'
2022-09-02 09:17:18: [ERROR] Traceback (most recent call last):
  File "res_mods/mods/xfw_packages\xvm_pymacro\python\__init__.py", line 157, in process
    return (func(), deterministic)
  File "res_mods/mods/xfw_packages\xvm_pymacro\python\__init__.py", line 123, in <lambda>
    return (lambda: func(*args), deterministic)
  File "res_mods/configs/xvm/py_macro\xvm.py", line 61, in xvm_formatDate
    formatDate = formatDate.decode('utf8').encode(_defaultlocale)
LookupError: unknown encoding: cp65001
arg='xvm.formatDate('%#S')'
2022-09-02 09:06:04: [ERROR] Traceback (most recent call last):
  File "res_mods/mods/xfw_packages\xvm_pymacro\python\__init__.py", line 156, in process
    (func, deterministic) = __get_function(arg)
  File "res_mods/mods/xfw_packages\xvm_pymacro\python\__init__.py", line 117, in __get_function
    args = ast.literal_eval(args_string)
  File "scripts/common/Lib/ast.py", line 49, in literal_eval
  File "scripts/common/Lib/ast.py", line 37, in parse
  File "<unknown>", line 1
    (,2)
     ^
SyntaxError: invalid syntax
arg='mod(,2)'

 

в моём конфиге без других модов этих ошибок нет :hmm:

----

походу евросервер :announce:

----

хз - решение вот походу:

28.12.2020 в 04:50, Shumaherxxx сказал:

Исправел ,путем снятие галочки тут

 265382358_Screenshot2020-12-30225730.png.fd8bf23d3f626b7ba95731968a548017.png

 

Share this post


Link to post

Short link
Share on other sites

Сервер не евро, а северо-американский. Не называл бы это решением, скорее костылем, но попробовал - помогло.

Edited by RegularMan

Share this post


Link to post

Short link
Share on other sites

I am editing my custom clock widget on the hangar. I found that in py_macro\xvm.py, the module datetime does not get "timezone" info, so I cannot get from

datetime.datetime.now()

and related things any timezone reference.

 

Instead, I found that the module "time" does.

 

So, In the py_macro\xvm.py file, I inserted the following lines:

 

import time

@xvm.export('xvm.tzoffset', deterministic=False)
def xvm_tzoffset():
    offset = time.strftime('%z')
    return offset

and in the widgetsTemplates.xc, I called it with

 

{{py:xvm.tzoffset}}

But nothing appears in the place. It does not crash the mod (so that the xvm resort to the default profile) either.

 

What should I do? If the code works as I intended, a text like

 

Quote

+0900

 

should appear in place.

 

 

 

Ahh, nevermind.

A bit of tweaking and restarting the client, now works.

Edited by Genba_Kantoku_s

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...