Beispiel #1
0
class NicoMovieLoad(nicoLoadBase):
    def __init__(self):
        nicoLoadBase.__init__(self)
        self.log = Log()
        self.status = ExcutionStatus()
        #self.db = Database()
        self.load = nicoLoadLoad(self.log, self.status, )#self.db)

        self.chPromptStr(u"Welcomeback ;-)")

        self.bind("exit", self.exitMainLoop)
        self.bind("load", self.load.nicoLoad_Load)
        self.bind("rss", self.load.rss)
        self.bind("nico", self.load.regNicoInfo)
        self.bind("gmail", self.load.regGmailInfo)
        self.bind("savedir", self.load.regSavedir)
        self.bind("help", self.help)

    def help(self, *args):
        """help"""
        for i in self.commandDict.keys():
            self.log.log(i, indent=False)

    def exitMainLoop(self, *args):
        self.mainLoop = False
        self.log.log(u"Good bye!\n")
        exit(1)

    def MainLoop(self):
        self.mainLoop = True
        while self.mainLoop:
            while True:
                line = self.prompt()
                if line != None and self.mainLoop: break
            parsedLine = self.parseCommand(line)
            self.runCommand(parsedLine)
Beispiel #2
0
    def __init__(self):
        nicoLoadBase.__init__(self)
        self.log = Log()
        self.status = ExcutionStatus()
        #self.db = Database()
        self.load = nicoLoadLoad(self.log, self.status, )#self.db)

        self.chPromptStr(u"Welcomeback ;-)")

        self.bind("exit", self.exitMainLoop)
        self.bind("load", self.load.nicoLoad_Load)
        self.bind("rss", self.load.rss)
        self.bind("nico", self.load.regNicoInfo)
        self.bind("gmail", self.load.regGmailInfo)
        self.bind("savedir", self.load.regSavedir)
        self.bind("help", self.help)
    def __init__(self, *args, **kwds):
        Log.__init__(self)
        self.__queueList = []
        self.__queueDict = {}
        if platform.system().lower() == "windows":
            # win用に書く
            pass
        else:
            home = os.getenv("HOME")
        nmlHome = os.path.join(home, WORKDIR)
        if not os.path.exists(nmlHome):
            os.mkdir(nmlHome)
        self.databasePath = os.path.join(nmlHome, DATABASE_FILE)
        self.systemDatabasePath = os.path.join(nmlHome, SYSTEM_DATABASE_FILE)

        db = Database(self.databasePath)
        db.ctTable()
        db.close()
        sdb = SystemDatabase(self.systemDatabasePath)
        sdb.ctTable()
        nid = sdb.getNicoid() if sdb.getNicoid() else u""
        npw = sdb.getNicopw() if sdb.getNicopw() else u""
        gid = sdb.getGmailid() if sdb.getGmailid() else u""
        gpw = sdb.getGmailpw() if sdb.getGmailpw() else u""
        sdr = sdb.getSavedir() if sdb.getSavedir() else u""
        sdb.close()

        self.nicoTable = NTable(nid, npw, gid, gpw, sdr)

        # begin wxGlade: NicoMovieLoadGUI.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.treeCtrl = gizmos.TreeListCtrl(self, -1, style=wx.TR_HAS_BUTTONS | wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HIDE_ROOT | wx.TR_DEFAULT_STYLE)
        self.pnlCenter = wx.Panel(self, -1)
        self.lblUrl = wx.StaticText(self.pnlCenter, -1, "URL:")
        self.tclUrl = wx.TextCtrl(self.pnlCenter, -1, "", style=wx.TE_PROCESS_ENTER)
        self.pnlBottom = wx.Panel(self, -1)
        self.lblQueueList = wx.StaticText(self.pnlBottom, -1, "QueueList:")
        self.lclQueueList = wx.ListCtrl(self.pnlBottom, -1, style=wx.LC_REPORT | wx.LC_AUTOARRANGE | wx.LC_NO_HEADER | wx.SUNKEN_BORDER)
        self.lblLog = wx.StaticText(self.pnlBottom, -1, "Log:")
        self.tclLog = wx.TextCtrl(self.pnlBottom, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.static_line_1 = wx.StaticLine(self, -1, style=wx.LI_VERTICAL)
        self.pnlRight = wx.Panel(self, -1)
        self.btnRss = wx.ToggleButton(self.pnlRight, -1, "RSS")
        self.btnAdd = wx.Button(self.pnlRight, -1, u"新規登録")
        self.btnLoad = wx.Button(self.pnlRight, -1, u"再ロード")
        self.btnClearLog = wx.Button(self.pnlRight, -1, u"ログ消去")
        self.btnDelete = wx.Button(self.pnlRight, -1, u"削除")
        self.btnSettings = wx.Button(self.pnlRight, -1, u"設定")
        self.btnExit = wx.Button(self.pnlRight, -1, "Exit")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
        self.__bind()
        self.__setTreeListCtrl()
        self.__set_QueueListCtrl()
        # other wigets
        self.dlgSettings = SettingsDialog(self.nicoTable, self.logging, self)
        # main
        self.nicoMain = NicoMovieLoadMain(self.databasePath, self.systemDatabasePath, self.logging)
        self.nicoMain.main()
        # timer
        timer = wx.Timer(self)
        timer.Start(3 * 1000)
        print "timer start"