roijac wrote:
why do I get Containers on some vars when opening a project in kurt? I got Container({'length': 4, 'data': [106, 134, 95, 169]}) instead of 2841609834 and Container({'length': 5, 'data': [212, 248, 93, 150, 2]}) instead of 11112675540
maybe some precision number saving?
Urgh, must be a bug in fixed_objects.py, maybe in LargePositiveInteger. Feel free to take a look for me Otherwise I'll try and fix it this evening. I think it's supposed to do something like:
number = 0
for x in reversed(data):
number <<= 8
number += x
Offline
blob8108 wrote:
roijac wrote:
why do I get Containers on some vars when opening a project in kurt? I got Container({'length': 4, 'data': [106, 134, 95, 169]}) instead of 2841609834 and Container({'length': 5, 'data': [212, 248, 93, 150, 2]}) instead of 11112675540
maybe some precision number saving?Urgh, must be a bug in fixed_objects.py, maybe in LargePositiveInteger. Feel free to take a look for me Otherwise I'll try and fix it this evening. I think it's supposed to do something like:
number = 0
for x in reversed(data):
number <<= 8
number += x
apparently it is O.O
didn't try it reversed
Offline
roijac wrote:
blob8108 wrote:
roijac wrote:
why do I get Containers on some vars when opening a project in kurt? I got Container({'length': 4, 'data': [106, 134, 95, 169]}) instead of 2841609834 and Container({'length': 5, 'data': [212, 248, 93, 150, 2]}) instead of 11112675540
maybe some precision number saving?Urgh, must be a bug in fixed_objects.py, maybe in LargePositiveInteger. Feel free to take a look for me Otherwise I'll try and fix it this evening. I think it's supposed to do something like:
number = 0
for x in reversed(data):
number <<= 8
number += xapparently it is O.O
didn't try it reversed
Fixed — I'll push to Github/PyPI once I get internet.
Offline
blob8108 wrote:
roijac wrote:
blob8108 wrote:
Urgh, must be a bug in fixed_objects.py, maybe in LargePositiveInteger. Feel free to take a look for me Otherwise I'll try and fix it this evening. I think it's supposed to do something like:
number = 0
for x in reversed(data):
number <<= 8
number += xapparently it is O.O
didn't try it reversedFixed — I'll push to Github/PyPI once I get internet.
Done! Should all work now.
Use
sudo pip install --upgrade kurt
to update (assuming you installed from PyPI...)
Last edited by blob8108 (2012-10-15 13:36:12)
Offline
bug reporting ftw xD
after you saved, you can't save again without load(), you get
File "/usr/local/lib/python2.7/dist-packages/kurt/files.py", line 94, in save bytes = self._save() File "/usr/local/lib/python2.7/dist-packages/kurt/files.py", line 167, in _save self.info["thumbnail"] = self.info["thumbnail"].form AttributeError: 'ColorForm' object has no attribute 'form'
Offline
roijac wrote:
bug reporting ftw xD
At least it's just you... considering more users find more bugs...
Thanks, anyway!
after you saved, you can't save again without load(), you get
Code:
File "/usr/local/lib/python2.7/dist-packages/kurt/files.py", line 94, in save bytes = self._save() File "/usr/local/lib/python2.7/dist-packages/kurt/files.py", line 167, in _save self.info["thumbnail"] = self.info["thumbnail"].form AttributeError: 'ColorForm' object has no attribute 'form'
Fixed — will upload in a few hours when I get home
I also allowed you to use `file.thumbnail` in addition to `file.info['thumbnail']`, just for fun
Offline
Pushed v1.4.4 to GitHub/PyPI:
Multiple ScratchProjectFile .save()s no longer throw errors
Can now access project info data using dot notation:
`file.info['thumbnail']` -> `file.thumbnail`
Offline
some questions o.O
how do I set parent morph of a script?
what do I pass to replace_sprite_refs?
what is the use of find_undefined_vars?
I'm getting closer and closer
edit: nm, got them xD
Last edited by roijac (2012-10-23 14:54:31)
Offline
roijac wrote:
how do I set parent morph of a script?
script.morph = ...
what do I pass to replace_sprite_refs?
what is the use of find_undefined_vars?
See my post, if you didn't find it.
Offline
roijac wrote:
got NotImplementedError: no field type for 171981620135355968629L
i guess a LargePositiveInteger or something?
Darn, I don't handle Python's `long` number type. Fixed. (Make sure you "sudo pip install --upgrade kurt", blah blah... )
Btw, in future you can test this with:
>>> from kurt.inline_objects import Field
>>> Field.build(171981620135355968629L)
(You've found bugs in inline_objects twice now... And that's supposed to be the simplest module!)
Last edited by blob8108 (2012-10-23 16:48:11)
Offline
MathWizz wrote:
(You've found bugs in inline_objects twice now... And that's supposed to be the simplest module!)
It amazing what creating a visualizer (as in editor) for the data can uncover.
Yes! It's also amazing what bugs people using your code can encounter…
Offline
Just a suggestion...
Maybe change the "when green flag clicked" to "when program starts/runs"? Now that you've made Scratch text-based, it would make more sense.
Offline
Lellowsfuzz wrote:
Just a suggestion...
Maybe change the "when green flag clicked" to "when program starts/runs"? Now that you've made Scratch text-based, it would make more sense.
The program still runs in Scratch, and Kurt converts directly between the text-based representation and a Scratch project, so it makes sense to use the same names for the blocks. Also, the code's syntax is identical to the scratchblocks plugin used on the forums/wiki, so using the same names makes it consistent with that, too.
Thanks for suggesting
Offline
Hi blob,
I'm trying to use Enchanting with leJos to run a robot. Since Enchanting is rather buggy when it comes to editing, I thought I might want to edit an Enchanting project in Xcode like you did with Scratch.
Will kurt work for this? Since Enchanting is a mod, it should have basically the same file format.
Offline
Hardmath123 wrote:
Will kurt work for this? Since Enchanting is a mod, it should have basically the same file format.
Cool idea! It really depends how similar the Enchanting file format is. It shouldn't be too hard to just fork Kurt and tweak/add things until it works -- at some point I'll figure out a way of supporting multiple formats (like .sb2) in Kurt itself.
Things like new blocks are pretty trivial -- I already parse blocks from the Squeak blockspecs (I have a little subset-of-Squeak syntax defined (using the binary parser Construct, of all things)) -- so you should just be able to paste in the new blockspecs straight from Enchanting's source.
Sounds like a fun project -- I'll go and try Enchanting!
Offline
...so it turns out Enchanting is based on BYOB, not directly Scratch, so it's a little more complicated
Offline
Yeah, should I have mentioned that?
Maybe you should first handle BYOB. That'll get Jens and Brian excited, too.
EDIT: Let's try to revive the Hex game at some point. The thing is, I'm totally stuffed with events till March (USAMTS, AMC, a bunch of robotics competitions (hence Enchanting), and school tests).
Last edited by Hardmath123 (2012-12-11 20:15:41)
Offline
Hardmath123 wrote:
Yeah, should I have mentioned that?
Maybe you should first handle BYOB.
EDIT: Let's try to revive the Hex game at some point. The thing is, I'm totally stuffed with events till March (USAMTS, AMC, a bunch of robotics competitions (hence Enchanting), and school tests).
I'm off on a train to another CS interview today, so I could finish the JS then if you want...
Offline
What version of Python?
Traceback (most recent call last): File "C:\Python27\Lib\site-packages\kurt-master\util\kurtgui.py", line 34, in <module> import kurt File "C:\Python27\lib\site-packages\kurt\__init__.py", line 43, in <module> from kurt.objtable import * File "C:\Python27\lib\site-packages\kurt\objtable.py", line 34, in <module> from user_objects import * File "C:\Python27\lib\site-packages\kurt\user_objects.py", line 373, in <module> class Sprite(ScriptableScratchMorph): File "C:\Python27\lib\site-packages\kurt\user_objects.py", line 420, in Sprite @costumes.fset TypeError: 'NoneType' object is not callable
Last edited by davidkt (2013-01-27 14:39:02)
Offline
davidkt wrote:
What version of Python?
Code:
Traceback (most recent call last): File "C:\Python27\Lib\site-packages\kurt-master\util\kurtgui.py", line 34, in <module> import kurt File "C:\Python27\lib\site-packages\kurt\__init__.py", line 43, in <module> from kurt.objtable import * File "C:\Python27\lib\site-packages\kurt\objtable.py", line 34, in <module> from user_objects import * File "C:\Python27\lib\site-packages\kurt\user_objects.py", line 373, in <module> class Sprite(ScriptableScratchMorph): File "C:\Python27\lib\site-packages\kurt\user_objects.py", line 420, in Sprite @costumes.fset TypeError: 'NoneType' object is not callable
Hmm. 2.7 should work -- but that line should read "@costumes.setter".
EDIT: Yeah, where have you installed from?
Last edited by blob8108 (2013-01-27 17:51:42)
Offline
Hey, blob, I can't get the .sprite files quite right - I'm doing it partly right because Scratch could display the right thumbnail in the open dialog, but it couldn't open it
I'm using this code: (it would be nice to have @sprite.setter, btw )
file = kurt.ScratchSpriteFile(path, load=False) file.stage = kurt.Stage() file.stage.submorphs.append(self.to_kurt()) file.save()
And I have here the .sprite file I got. Help?
Offline
roijac wrote:
(it would be nice to have @sprite.setter, btw )
Yeah, sprite file support is slim
The file you gave me opens fine in BYOB, but not Scratch. Weird. I can't really help anymore without seeing your code...
EDIT: random guess here, but based on the Squeak traceback I'd say your Sprite (or maybe the costume?) doesn't have a valid "position" property.
Last edited by blob8108 (2013-03-29 09:31:36)
Offline
blob8108 wrote:
roijac wrote:
(it would be nice to have @sprite.setter, btw )
Yeah, sprite file support is slim
The file you gave me opens fine in BYOB, but not Scratch. Weird. I can't really help anymore without seeing your code...
EDIT: random guess here, but based on the Squeak traceback I'd say your Sprite (or maybe the costume?) doesn't have a valid "position" property.
Sprites don't have positions, they have only bounds
Last edited by roijac (2013-03-29 10:02:25)
Offline