« first day (284 days earlier)      last day (2117 days later) » 
11:00 - 22:0022:00 - 00:00

10:00 PM
ok so now I go to the tasktrackercontroller
and under updateweight
I subscribe the message that is being sent
how do I subscribe to another file though?
I import it:
> from views import tasktrackerpanel
 
@KronoS you can subscribe to anything/everything
messages go everywhere, your app shares one instance of pubsub
 
and then pub.subscribe(????, "ButtonClass.toggeledbutton)
 
well technically not even that, you just have one pubsub on your whole computer
 
@IvoFlipse oh so I don't need to import
 
???? = your function
well you need to import pubsub
from wx.lib.pubsub import Publisher as pub
which you already have
 
10:06 PM
right
 
so instead of that Weights class, I think we can suffice with just a simple function
 
is a little bit lost
brb (gonna get some water)
ok back...
 
ok, so what part is troubling you
 
ok so I know that I need to send a message from tasktrackerpanel to tasktrackercontroller
I've created the message... now I don't know how to subscribe exactly
pub.subscribe('what','what')
AND how in the WORLD did you figure this all out in just a few short months
 
@KronoS in university you learn whole topics in mere months, so I did the same only I just had one topic
 
10:13 PM
oh I guess that's true
 
anyway you pub.subscribe('message', function)
 
Ah... ok so in this exact case it's
wait isn't it the other way...
function and then message?
pub.subscribe(self.store_result, "tasktrackerpanel.store_result")
cuz i saw this
 
ah yeah, I did it the other way around
you are correct
 
so this is what I need to do
in the init of the TaskTrackerController
and actually I'm changing the message to be 'tasktrackerpanel.toggeledbutton'
so it's easier to trace
 
careful to subscribe functions that don't have (self, message) in their def statement
pubsub checks for these things and will give you an error if the function can't accept more arguments
 
10:20 PM
ok... so now i have the two linked up...
 
ok then what do you do
 
ok just sent a push just in case something happened... (I also made some interface changes)
 
pub.subscribe()

test = 0;
 
@IvoFlipse well I'm guess that I need to do something with updateweight
 
subscribing to () means you subscribe to everything == bad ;P
 
10:31 PM
ignore that for now
I just deleted it anyways...
 
in the init add:
self.weight
the in this function do
self.weight = message.data['state']
 
@IvoFlipse 'this' meaning init?
 
class TaskTrackerController(object):
    def __init__(self, app, model):
        self.app = app
 
and I'm assuming that I need to do this after the subscription lines
right that's what I was talking about
 
no, just initialize self.weight = 0
 
10:33 PM
ok that's done
 
btw
 
@IvoFlipse wait what?
 
add a line: assert self.weight >= 0 # check if self.weight isn't negative (for whatever reason)
@KronoS in the init, add that line
then in your function you change the value
 
ok so I have in init:
> self.weight >= 0
then in updateweight:
I need what?
 
self.weight = message.data['state']
 
10:38 PM
ok... so why did I need to have the self.weight >= 0 in the init function?
 
@KronoS oh weight its: self.weight += message.blabla
because you have to create the object somewhere, in the init means it exists as soon as the instance exists
 
oh... ok
so in init i need self.weight += message.['state']
 
no in the function
 
so i leave self.weight >= 0
 
paste your code in some google docs
and I'll tell you what to change
 
11:31 PM
I pushed the update @IvoFlipse
 
11:00 - 22:0022:00 - 00:00

« first day (284 days earlier)      last day (2117 days later) »