예제 #1
0
def split(uvm, splitType, splitView):
    log.debug(type(uvm.allViews))
    log.debug(uvm.allViews.focus)
    if splitType == 0:
        if type(uvm.allViews) is urwid.Pile:
            log.debug('Pile supertype')
            uvm.allViews.contents.append((View(uvm), uvm.allViews.options()))
        else:
            log.debug(uvm.allViews.contents)
            uvm.allViews.focus = urwid.Pile([uvm.currFocusView, View(uvm)])
    elif splitType == 1:
        if type(uvm.allViews) is urwid.Columns:
            log.debug('Columns supertype')
            uvm.allViews.contents.append((View(uvm), uvm.allViews.options()))
        else:
            uvm.allViews.focus = urwid.Columns([uvm.currFocusView, View(uvm)])

    postCommand(uvm)
예제 #2
0
def site(uvm):
    preCommand(uvm)
    if uvm.site is SITE.FCHAN:
        log.debug(uvm.allViews.focus)
        uvm.allViews = View(uvm, IndexFrame(uvm))
        # uvm.currFocusView.setFrame(IndexFrame(uvm))
        # setattr(uvm.currFocusView, 'frame', IndexFrame(uvm))
        # uvm.currFocusView = View(uvm, IndexFrame(uvm))
        # uvm.allViews.set_focus = (View(uvm, IndexFrame(uvm)), uvm.allViews.options())
    postCommand(uvm)
예제 #3
0
def systemCommands(cmd, uvm):
    cmd = cmd.split()

    if cmd[0] in ('qa', 'quitall'):
        DEBUG('Executing quit command')
        sys.exit()

    if cmd[0] in ('site'):
        DEBUG('executing site command')
        DEBUG(cmd)
        if cmd[1] in '4chan':
            DEBUG('4chan requested')
            setattr(uvm.currFocusView, 'site', SITE.FCHAN)
            setattr(uvm.currFocusView, 'boardList',
                    uvm.cfg.get('FCHAN')['boards'])
            setattr(uvm.currFocusView, 'frame', IndexFrame(uvm))
        elif cmd[1] in ['reddit', 'Reddit']:
            setattr(uvm.currFocusView, 'site', SITE.REDDIT)
            setattr(uvm.currFocusView, 'boardList',
                    uvm.cfg.get('REDDIT')['boards'])
            setattr(uvm.currFocusView, 'frame', RedditIndexFrame(uvm))

    if cmd[0] in ('split'):
        if type(uvm.splitTuple) is Row:
            uvm.splitTuple.widgets.append(View(uvm))
        else:
            t = uvm.splitTuple
            uvm.splitTuple = Row()
            uvm.splitTuple.widgets.append(t)
            uvm.splitTuple.widgets.append(View(uvm))
        pass
    elif cmd[0] in ('vsplit'):
        if type(uvm.splitTuple) is Column:
            uvm.splitTuple.widgets.append(View(uvm))
        t = uvm.splitTuple
        uvm.splitTuple = Column()
        uvm.splitTuple.widgets.append(t)
        uvm.splitTuple.widgets.append(View(uvm))
예제 #4
0
def board(uvm, boardString):
    preCommand(uvm)
    log.debug('executing board command')
    # uvm.allViews.contents[uvm.allViews.focus_position] = (View(uvm, BoardFrame(boardString, uvm)), uvm.allViews.options())
    uvm.allViews = View(uvm, BoardFrame(boardString, uvm))
    postCommand(uvm)
예제 #5
0
def thread(uvm, boardString, threadNumber):
    preCommand(uvm)
    uvm.allViews = View(uvm, ThreadFrame(boardString, threadNumber, uvm))
    postCommand(uvm)
예제 #6
0
 def buildSetStartView(self):
     self.currFocusView = View(self, DefaultFrame(True))