Exemplo n.º 1
0
    def SendMessage(self):
        print "%s: Telling students the projects" % (self.name)
        ps.Publisher().sendMessage('Set Student Project',
                                   self.course.projects_dict)

        print "\n%s: Telling students the grades" % (self.name)
        ps.Publisher().sendMessage('Set Student Grade',
                                   self.course.grades_dict)
Exemplo n.º 2
0
    def OnNotebookPageChanged(self, event):
        """
        Fire notifications so that the frame can handle changes to the active convo.
        """
        page = self.notebook.GetPage(event.GetSelection())

        icon = imwin_gui.icons.get(page.icontype, 'buddy')(page.Buddy)
        pubsub.Publisher().sendMessage(('tab', 'icon', 'updated'),
                                       (page, icon))
        pubsub.Publisher().sendMessage(('tab', 'title', 'updated'),
                                       (page, page.Buddy.alias, None))
Exemplo n.º 3
0
    def BindEventsToFrame(self):
        Bind = self.frame.Bind
        Bind(wx.EVT_CLOSE, self.OnClose)
        Bind(wx.EVT_MOVE, self.OnMove)
        Bind(wx.EVT_SIZE, self.OnSize)
        Bind(wx.EVT_ACTIVATE, self.OnActivate)
        Bind(EVT_TAB_NOTIFIED, self.OnTabNotify)

        publisher = pubsub.Publisher()
        publisher.subscribe(self.OnPageTitleUpdated, 'tab.title.updated')
        publisher.subscribe(self.OnPageIconUpdated, 'tab.icon.updated')
Exemplo n.º 4
0
    def BindEventsToFrame(self):
        """
        Any events the native IM frame should always handle (i.e. even when inactive) should be connected here.
        """
        self.frame.Bind(wx.EVT_ACTIVATE, self.OnActivate)
        self.frame.Bind(wx.EVT_CLOSE, self.OnClose)
        self.frame.notebook.Bind(EVT_FNB_DRAG_STARTED, self.OnFNBTabDragStart)

        publisher = pubsub.Publisher()
        publisher.subscribe(self.OnPageTitleUpdated, 'tab.title.updated')
        publisher.subscribe(self.OnPageIconUpdated, 'tab.icon.updated')
Exemplo n.º 5
0
    def __init__(self, parent, analysis):
        gridlib.Grid.__init__(self, parent, -1)
        self.analysis = analysis
        table = BatchAnalysisTable(analysis)

        # The second parameter means that the grid is to take ownership of the
        # table and will destroy it when done.	Otherwise you would need to keep
        # a reference to it and call it's Destroy method later.
        self.SetTable(table, True)
        self.SetRowLabelSize(120)
        self.SetLabelFont(
            wx.Font(9, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL))
        pubsub.Publisher().subscribe(self.updateGrid, "UpdateGrid")
Exemplo n.º 6
0
    def OnClose(self, event):
        """
        Disconnect any notifications we have in place.
        """

        if self.frame.CloseAndSaveState(event):
            publisher = pubsub.Publisher()
            publisher.unsubscribe(self.OnPageTitleUpdated, 'tab.title.updated')
            publisher.unsubscribe(self.OnPageIconUpdated, 'tab.icon.updated')

            self.DisconnectToolBarEvents()

            self.frame.Destroy()
            del self
        else:
            event.Veto()
Exemplo n.º 7
0
    def __init__(self, parent, mainframe, filename, documenttype):
        self.initmixin()

        wx.SplitterWindow.__init__(self, parent, -1, style = wx.SP_LIVE_UPDATE )
        DocumentBase.DocumentBase.__init__(self, parent, filename, documenttype)
        self.parent = parent
        self.mainframe = mainframe
        self.pref = mainframe.pref

        self.datas = RssDataPage(self, self.mainframe)

        self.view = HtmlPage.HtmlPage(self, mainframe, filename, documenttype)

        self.SetMinimumPaneSize(50)
        self.SplitHorizontally(self.datas, self.view, 250)

        self.publisher = pubsub.Publisher()
        self.publisher.subscribe(self.OnChangeHtml, 'change_html')

        self.data = []
        self.guids = {}
Exemplo n.º 8
0
    def __init__(self, parent):
        self.parent = parent
        self.sharewin = parent
        self.pref = parent.pref
        self.categories = {}
        self.cate_items = {}
        self.feeds = {}
        self.publisher = pubsub.Publisher()
        self.publisher.subscribe(self.OnUnreadChanged, 'rss_unread_changed')

        self.casings = {}

        #check rss reader data dir
        self.rootpath = path = os.path.join(Globals.userpath, 'rssreader')
        if not os.path.exists(path):
            os.mkdir(path)
        self.iconpath = path = os.path.join(Globals.userpath,
                                            'rssreader/FavIcons')
        if not os.path.exists(path):
            os.mkdir(path)

        for f in os.listdir(self.iconpath):
            imagefile = os.path.join(self.iconpath, f)
            name = os.path.splitext(f)[0]
            nolog = wx.LogNull()
            ok = wx.Image(imagefile, wx.BITMAP_TYPE_ANY).Ok()
            del nolog
            if not ok:
                continue
            self.sharewin.add_image(name, imagefile)

        Globals.rss_data_path = self.rootpath
        Globals.rss_dbfile = os.path.join(self.rootpath,
                                          Globals.mainframe.pref.rss_dbfile)

        for name in [
                'RSS_ROOT_IMAGE', 'RSS_CATEGORY_IMAGE', 'RSS_FEED_IMAGE',
                'RSS_RUN1', 'RSS_RUN2', 'RSS_RUN3', 'RSS_ERROR'
        ]:
            setattr(self, name, self.sharewin.get_image_id(name))
Exemplo n.º 9
0
    def __init__(self, parent, mainframe):
        self.initmixin()

        self.parent = parent

        wx.Panel.__init__(self, parent, -1)

        self.publisher = pubsub.Publisher()

        box = wx.BoxSizer(wx.VERTICAL)
        self.list = CheckList.CheckList(self, columns=[
            (tr("Subject"), 400, 'left'),
            (tr("Date"), 120, 'left'),
            ], check_image=images.getCheckBitmap(), uncheck_image=images.getUncheckBitmap(),
            style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        self.list.on_check = self.OnCheck

        box.Add(self.list, 1, wx.EXPAND|wx.ALL)
        self.SetSizer(box)
        self.SetAutoLayout(True)

        wx.EVT_LIST_ITEM_SELECTED(self.list, self.list.GetId(), self.OnChanged)
Exemplo n.º 10
0
 def __bind_events(self):
     ps.Publisher().subscribe(self.ReceiveProject, 'Set Student Project')
     ps.Publisher().subscribe(self.ReceiveGrade, 'Set Student Grade')
Exemplo n.º 11
0
 def __bind_events(self):
     ps.Publisher().subscribe(self.RemovePiece, 'Eat piece of pizza')
Exemplo n.º 12
0
 def equalise(self, regions):
     channels = self.get_channel_numbers()
     factor = self.channels['00'].get_flat(regions)
     for channel in channels:
         self.counts[channel] = self.channels[channel].equalise(factor, regions)
     pubsub.Publisher().sendMessage('REPLOT')
Exemplo n.º 13
0
 def substract_dark(self, regions):
     channels = self.get_channel_numbers()
     for channel in channels:
         self.counts[channel] = self.channels[channel].substract_dark(regions)
     pubsub.Publisher().sendMessage('REPLOT')