Beispiel #1
0
 def resetWorkspace(self):
     os.chdir(Workspace().path)
     print '---resetWorkspace---->', os.getcwd()
     listOfDir = os.listdir(Workspace().path)
     if len(listOfDir) > 0:
 #         print len(listOfDir)
         isDatabase = False
         for sName in listOfDir:
             if ".sqlite" in str(sName):
                 print sName
                 isDatabase = True
         if not  isDatabase:
             createDatabase = CreateDatabase()
             session = createDatabase.creatingDatabase()
             createDatabase.addingData()
Beispiel #2
0
    def __init__(self, baseUrl=None):
        '''
        Constructor
        '''
        self.baseUrl = baseUrl
        self.directory_name = Workspace().libraryPath
        self.createDatabase = CreateDatabase()
        self.header_info = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0'
        }

        # book image url
        self.imageUrl = None
        self.bookUrl = None
        pass
Beispiel #3
0
    def __init__(self, parent):
        title = "Opal"
        size = wx.DefaultSize
        style = wx.DEFAULT_FRAME_STYLE | wx.MAXIMIZE | wx.SUNKEN_BORDER
        #         wx.Frame.__init__(self, parent, wx.ID_ANY, title, pos, size, style)
        wx.Frame.__init__(self, parent, wx.ID_ANY, title=title, style=style)
        print '1----------------------->'
        image = wx.Image(
            os.path.join(Workspace().appPath, "images", "Library-icon.png"),
            wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        icon = wx.EmptyIcon()
        icon.CopyFromBitmap(image)
        # set frame icon
        self.SetIcon(icon)

        if not os.path.exists(Workspace().libraryPath):
            self.createWizard()
        self.createDatabase = CreateDatabase()
        #         self.creatingDatabase()

        self.books = list()
        self.thumbnail = None
        self.fileDropTarget = FileDropTarget(self)
        #         self.grid = wx.grid.Grid(self, -1, wx.Point(0, 0), wx.Size(150, 250),wx.NO_BORDER | wx.WANTS_CHARS)

        self._mgr = aui.AuiManager()
        # tell AuiManager to manage this frame
        self._mgr.SetManagedWindow(self)

        # set up default notebook style
        self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
        self._notebook_theme = 0
        # Attributes
        self._textCount = 1
        self._transparency = 255
        self._snapped = False
        self._custom_pane_buttons = False
        self._custom_tab_buttons = False
        self._pane_icons = False
        self._veto_tree = self._veto_text = False
        print '1----------------------->', os.getcwd()
        os.chdir(os.path.dirname(os.path.abspath(__file__)))

        self.BuildPanes()
        self.CreateMenuBar()
        self.BindEvents()
        self.buildStatusBar()
Beispiel #4
0
def main():
    #     global books, frame
    #     session = CreateDatabase().creatingDatabase()
    # #     CreateDatabase().addingData(session)
    #     books = CreateDatabase().findAllBook(session)
    #     bookName = 'head'
    #     books = CreateDatabase().findByBookName(session, bookName)
    if Workspace().libraryPath + os.sep + '_opal.sqlite':
        if os.stat(Workspace().libraryPath + os.sep +
                   '_opal.sqlite').st_size == 0:
            c = CreateDatabase()
            c.creatingDatabase()
            c.addingData()
            print 'data loaded'
    app = wx.App(0)
    frame = MainWindow(None, "My Calibre")
    app.MainLoop()
Beispiel #5
0
    def __init__(self, parent):
        """Constructor"""
        aui.AuiNotebook.__init__(self, parent=parent)
        self.default_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
        self.SetWindowStyleFlag(self.default_style)

        # Create the first tab and add it to the notebook
        self.gallery = TabPanel(self)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.thumbnail = ThumbnailCtrl(self.gallery,
                                       imagehandler=NativeImageHandler)
        self.thumbnail._scrolled.EnableToolTips(enable=True)

        # # Todo
        books = list()
        print '1.---->', os.getcwd()
        #         os.chdir('/home/vijay/Documents/Aptana_Workspace/util/src/dao')
        print '2.---->', os.getcwd()
        #         session = CreateDatabase().creatingDatabase()
        #         CreateDatabase().addingData()
        #         books = CreateDatabase().findByBookName("python")
        books = CreateDatabase().findAllBook()

        if books != None:
            self.thumbnail.ShowDir(books)
        self.sizer.Add(self.thumbnail, 1, wx.EXPAND | wx.ALL, 10)
        self.gallery.SetSizer(self.sizer)

        self.tabOne = TabPanel(self)
        self.tabOne.addItems()
        #         tabOne.SetBackgroundColour("Gray")
        bookImage = wx.ArtProvider.GetBitmap(wx.ART_HELP_BOOK, wx.ART_OTHER,
                                             wx.Size(16, 16))
        galleryImage = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
                                                wx.ART_OTHER, wx.Size(16, 16))
        self.AddPage(self.gallery, "Gallery", False, galleryImage)
        self.AddPage(self.tabOne, "Books", False, bookImage)
        style = self.DEFAULT_STYLE

        self.SetWindowStyleFlag(style)
        self.SetArtProvider(aui.AuiDefaultTabArt())
Beispiel #6
0
    def __init__(self,
                 group=None,
                 target=None,
                 name=None,
                 args=(),
                 kwargs=None,
                 verbose=None):
        '''
        Constructor, setting location of downloaded book.
        '''
        super(DownloadItEbook, self).__init__(group=group,
                                              target=target,
                                              name=name,
                                              verbose=verbose)

        self.args = args
        self.kwargs = kwargs
        self.directory_name = Workspace().libraryPath
        self.createDatabase = CreateDatabase()
        pass
    def initUI(self):
        vBox = wx.BoxSizer(wx.VERTICAL)
        self.thumbnail = ThumbnailCtrl(self.frmPanel,
                                       imagehandler=NativeImageHandler)
        self.thumbnail._scrolled.EnableToolTips(enable=True)
        #         toolbar = wx.ToolBar(self.thumbnail )
        #         toolbar.AddLabelTool(1, '', wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, (16, 16)))
        #         toolbar.Realize()
        self.statusbar = self.CreateStatusBar()
        self.statusbar.SetStatusText('Ready')
        books = list()
        books = CreateDatabase().findAllBook()

        if books != None:
            self.thumbnail.ShowDir(books)


#         vBox.Add(toolbar)
        vBox.Add(self.thumbnail, 1, wx.EXPAND | wx.ALL, 10)
        self.frmPanel.SetSizer(vBox)
        self.frmPanel.Layout()
        self.Show(True)
Beispiel #8
0
 def __init__(self, libraryPath=None):
     self.libraryPath = libraryPath
     self.createDatabase = CreateDatabase(libraryPath=libraryPath)
     pass
Beispiel #9
0
 def __init__(self):
     self.createDatabase = CreateDatabase()
     pass
Beispiel #10
0
 def __init__(self):
     self.book = Book()
     self.book.uuid = str(uuid.uuid4())
     self.book.tag = None
     self.book.authors = list()
     self.createDatabase = CreateDatabase()
Beispiel #11
0
 def setUp(self):
     print 'setUp'
     self.createDatabase = CreateDatabase()
Beispiel #12
0
 def __init__(self):
     self.baseUrl = "https://www.packtpub.com/"
     self.directory_name = Workspace().libraryPath
     self.createDatabase = CreateDatabase() 
 def reloadingDatabase(self, event):
     logger.debug('reloadingDatabase')
     self.createDatabase = CreateDatabase(libraryPath=self.libraryPath)
     self.createDatabase.creatingDatabase()
     self.createDatabase.addingData()
     self.loadingBook(searchText=self.search.GetValue())