« first day (3 days earlier)      last day (150 days later) » 

12:00 PM
i suggest .sync() to hurry up the disk write
 
are you sure about that?
 
pull speedups
we should see significant increase.
whispers there?
dang @jokerdino
 
hey
yeah, what was it?
 
pull from repo.
and retry.
I am expecting massive speed improvements.
 
12:12 PM
can i throw away local modifications in git repo?
 
yup.
 
ok git stash
no massive changes
very well, if you are going to stick to .apply(), i won't see any change
 
that .apply doesn't get called. :P
 
and nothing gets applied either
use .sync()
 
does it really make a difference? check it.
 
12:15 PM
yes
 
I use .apply() only when I detect delay apply mode.
get rid of it if necessary.
 
here goes: sync() shows instant change but the overall process is slow.
if nothing, no instant change but looks like it still takes the same time to complete the process
 
is it because I'm creating a class?
seriously, no difference other than that.
 
possibly?
 
But this is cleaner.
We'll stick.
 
12:19 PM
well, it takes a looong time to update
 
Lets ask someone.
didrocks, may be?
 
perhaps
there is a ~ file in git
 
how can there be?
I didn't commit any I believe..
lemme check
untracked.
 
thanks
 
??
 
12:22 PM
nvr mind
what next?
 
finish the half written unittest.py :P
 
why is one thing symlinked to the other?
 
I need to import.
 
hm okay
 
for that, I cant have hyphens.
 
12:24 PM
then remove the master file or something
 
So i just symlinked for the time being.
 
okay.
 
can you finish the half-complete unittest.py?
 
okay. o.O
 
:P
I'm teaching you python, buddy.
thank me.
 
12:26 PM
i have written something in tests/booltest.py
do something for string array and others
 
why nsettings in filelens?
 
i didn't have a def earlier
 
and gsettings in the other?
 
then put it under a def
 
oh. okay.
we dont need to test for each type.
we are not using anything thats type-specific.
 
12:30 PM
we need to test for com.cano.. and org.compiz. also test with changing the plugins.
one reloco. and one static and one with changing plugins
 
open up unittest.py
add as many testcases we want as methods.
 
okay
what?
 
only condition is they must start with test_
 
o.O
ok. set.
how does the test work?
 
scroll down to basic example.
 
12:33 PM
i see that.
 
need help?
 
yeah
 
okay. where exactly are you stuck?
 
how exactly are we testing anything?
i can set an option away from default but then on, how?
 
pick something to change and test if its reset
then write a def test_something
in that method, we set the value away from default.
 
12:40 PM
makes sense. let me whip out something.
 
then call unityreset.UnityReset()
 
okay :))
 
then self.assertTrue(key==itsdefaultvalue)
 
Righto.
 
you know the key because you picked it. get its value.
default values are there in the dicts.
 
12:42 PM
o.O
where is the dict?
 
setUp()
two variables. you see them?
they are dicts.
 
yeah but they are just the plugins?
where do i get the key value?
 
compizPlugins[pluginschema][key] should give you the value.
similarly for the other one.
 
okay o.O
brb
 
The magic of nested dicts. :D
okay.
why do I see your ghost here? @jrg :P
 
jrg
12:46 PM
because i am everywhere and nowhere
 
oh.
 
yes
 
yes what?
 
yes
the troll answer
@mahesh, can i just use the booltest.py?
 
grab it and add as methods in unittest.py
 
12:53 PM
yes that
 
to reset, you have unityreset.UnityReset()
and dont import Gio again.
 
neat
no i wont
 
use Gio=unityreset.Gio if at all needed.
you'll need that to set key to non default value.
 
i was doing it in booltest
 
weren't you copying it into unittest?
 
12:56 PM
just following the style
 
umm... one unittest.py will cover all test cases.
each def test_something will be a testcase.
all will be taken care of unittest.
 
got it
 
so, better copy things over and get rid of rest.
 
 def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_boolean("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_boolean("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_boolean("display-recent-apps")
        self.assertTrue(key==True)
like that?
 
yup. something like that.
 
1:00 PM
how do i test what i wrote is not rubbish?
 
use get_value if instead of all variants.
 
ok done
 
just run the file.
 
AttributeError: 'module' object has no attribute 'TestCase'
hm
 
ah. rename the file to something else and retry.
:P
 
1:03 PM
which file?
 
unittest.py
it conflicts with module name.
 
oh
 
renameit to unityresetunittestsohilovelongnames.py
 
same error
$ python faketest.py
Traceback (most recent call last):
  File "faketest.py", line 3, in <module>
    import unittest
  File "/home/jokerdino/unity-reset/unittest.py", line 7, in <module>
AttributeError: 'module' object has no attribute 'TestCase'
 
is unittest.py still there?
get rid of unittest.py. rename it.
 
1:06 PM
ok there was a pyc
File "faketest.py", line 12, in setUp
    compizPlugins=unityreset.UnityReset.snapshotCompizPlugins()
TypeError: unbound method snapshotCompizPlugins() must be called with UnityReset instance as first argument (got nothing instead)

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
 
oh.
gimme a sec.
git commit locally then git pull origin master
 
ok
 
updated unity-reset.py. the methods were not static earlier.
 
mhk
different error
Traceback (most recent call last):
  File "faketest.py", line 12, in setUp
    compizPlugins=unityreset.UnityReset.snapshotCompizPlugins()
  File "/home/jokerdino/unity-reset/unityreset.py", line 95, in snapshotCompizPlugins
    for schema in allRelocatableSchemas:
NameError: global name 'allRelocatableSchemas' is not defined

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
 
pull and retry
 
1:19 PM
it resets my unity
but no result of whether pass or fail
i should have waited. my bad
trying again
 
oh.
 
fail
 
actually, unity doesn't return control I guess. scroll and find things in output.
 
Killed
F
======================================================================
FAIL: test_staticschema (__main__.TestUnityReset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "faketest.py", line 26, in test_staticschema
    self.assertTrue(key==True)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 41.561s

FAILED (failures=1)
started another unity in another terminal
 
you sure that key goes to true?
 
1:22 PM
 def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_value("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_value("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_value("display-recent-apps")
        self.assertTrue(key==True)
 
wait....
 
either i should wait for it to be written or i am doing it wrong?
i am thinking i should use set_boolean instead
 
you have to check unityChildren['com.canonical.Unity.ApplicationsLens']['display-recent-apps']
why do you do this?
 
do what?
 
if "display-recent-apps" in gsettings.list_keys():
if gsettings.get_value("display-recent-apps") is True:
#print "Unsetted default"
gsettings.set_value("display-recent-apps",False)
 
1:24 PM
you said copy from booltest.py
 
oh. okay.
open python shell
in the same folder.
import unityreset
 
then
 
unityChildren=unityreset.UnityReset.snapshotUnityChildren()
unityChildren['com.canonical.Unity.ApplicationsLens']['display-recent-apps']
what does it say?
 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/overrides/GLib.py", line 182, in __repr__
    return "GLib.Variant('%s', %s)" % (self.format_string, self.print_(True))
AttributeError: 'Variant' object has no attribute 'format_string'
 
appears
how's it going?
 
1:26 PM
bad. :/
 
What's wrong
I wasn't really paying attention that time
 
print unityChildren['com.canonical.Unity.ApplicationsLens']['display-recent-apps']
 
true
small true
not True
 
jrg
do you guys need/want help?
 
okay.
so the default is true.
@jrg yup.
 
1:28 PM
@jrg yup
 
then we set it to false.
set it.
 
jrg
alright, let me go re-read the log
 
i am checking for True and not true
 
Gio=unityreset.Gio
@jokerdino yup that.
thats the prob then.
 
Killed
.
----------------------------------------------------------------------
Ran 1 test in 47.496s

OK
actually, the problem was with get_value and get_boolean
def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_boolean("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_boolean("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_boolean("display-recent-apps")
        self.assertTrue(key==True)
this works -^
might be either set_boolean or get_boolean
 
1:31 PM
yup.
the return type is bad for us.
lets stash my fancinedd and do it the good old way then.
 
Ok, now can someone explain to me what in the name of gnu is going on?
:P
 
dino will tell you.
 
Killed
F
======================================================================
FAIL: test_staticschema (__main__.TestUnityReset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "faketest.py", line 26, in test_staticschema
    self.assertTrue(key==True)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 33.244s

FAILED (failures=1)
def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_value("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_boolean("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_value("display-recent-apps")
        self.assertTrue(key==True)
 
@jokerdino Tell me
 
so, we should use get_boolean @Mahesh
 
1:33 PM
yup.
 
@AmithKK writing unit tests
 
or change the assertTrue statement.
 
to true?
 
key is a Glib.Variant type.
 
oh
 
1:33 PM
so, see if key==Glib.Variant(true) works.
 
ok
how can I help :D
 
but we need to import something to access Glib.
@AmithKK once we get the first unit test straight.
 
@Mahesh from gi_repository :P ?
 
jrg
or can you stub your glib responses?
 
we'll each pick one and rock.
 
1:35 PM
ok trying with true
 
@jokerdino try from gi.repository import Glib in python shell
 
jrg
i'm not as up-to-date on my python testing frameworks, but in ruby I can stub a response for an external API or something.
 
@jokerdino nope. you have to try it with a Glib.Variant type object.
not a string.
 
true fails. we should just use get_boolean :P
 
@jrg stub?
 
jrg
1:36 PM
that way i just import the response, and not the actual library, since the library can break.
 
@jokerdino just use get_boolean
 
nope. lets try things better.
 
jrg
@Mahesh ok, guess it doesn't support that. ignore me.
 
you are talking of doctest.
 
@jrg I don't think the unit test framework supports stubbing. :D
 
1:37 PM
well, the python counterpart is doctest.
 
@Mahesh Never used that :P
 
jrg
@AmithKK this is a lame testing framework. :P
 
@jokerdino open up a python shell.
 
you mean import GLib
then what?
 
jrg
anyway. i'll try and catch up on this stuff.
 
1:37 PM
from gi.repository import GLib,Gio
 
okay
next?
 
a=Gio.Settings("com.canonical.Unity.ApplicationsLens").get_value("display-recent-apps")
 
a=Gio.Settings("com.canonical.Unity.ApplicationsLens").get_value("display-recent-apps")
>>> print a
true
 
okay.
b=GLib.Variant(True)
print b
 
You need to assign Ninja'd
 
1:39 PM
a==b
if thats a true, congratulate me.
 
 b=GLib.Variant(True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __new__() takes exactly 3 arguments (2 given)
 
great.
dig up its constructor.
 
wut?
 
dig up documentation for GLib.Variant
 
1:45 PM
we should use this :P
 
hm, fire drill
fire drill. bye!
 
b=GLib.Variant('b',True)
@jokerdino enjoy. :P
 
@jokerdino bye
happy fire drill
Grr
 
b=GLib.Variant('b',True)
>>> a==b
True
 
you know what? this is one of the most horribly undocumented areas
@jokerdino Thanks. :D
 
1:46 PM
yeah
I approve
 
okay. good luck
bbl
 
@jrg we were working with nearly zero documentation support. any ideas?
 
okay, someone turned off the fire alarm, i am back
 
jrg
1:48 PM
Write documentation for the next guy?
 
yay!!!!
@jrg bah
 
Aww screw this
 
jrg
Ok, re-reading
 
we're writing a huge blog post after this
 
now i congratulate you. what next @mah?
 
1:49 PM
@jokerdino @jokerdino okay. Use my beautiful dict to see defaults.
reset as we did.
 
gimme code
 
then while asserting true,
 
jrg
@Mahesh: so you got it working (after a fashion), right?
 
aaarrrrgh.
wait then.
 
@jrg yeah :D
 
1:49 PM
@jrg yup. its all working now.
 
ok real f-ing fire
OH MY GOD
 
@jokerdino RUN
 
BBBBBBYE
 
RUN LIKE THE WIND
be safe
bye @jokerdino
 
jrg
Be safe @jokerdino
 
1:57 PM
what? real fire??? o_O
hmm.. okay.
@AmithKK pull it and write some more methods in similar way.
@jrg you can help us here.
 
jrg
who has a copy of the latest code, and can i git clone it?
 
@jrg yep
 

« first day (3 days earlier)      last day (150 days later) »