def __init__(self, parent=None, *args, **kw):
        wx.Panel.__init__(self,
                          parent,
                          id=-1,
                          style=wx.CLIP_CHILDREN | wx.BORDER_NONE)
        self.parent = parent
        self.data = list()
        self.pin = False
        vBox = wx.BoxSizer(wx.VERTICAL)
        self.fileOperations = FileOperations()
        ####################################################################
        self.topResultToolbar = self.constructTopResultToolBar()
        self.bottomResultToolbar = wx.StatusBar(self)
        self.bottomResultToolbar.SetStatusText('Count: {}'.format(
            len(self.getData())))
        #         self.bottomResultToolbar = self.constructBottomResultToolBar()
        #         self.resultPanel = ResultPanel(self, data=self.getData())
        self.resultPanel = ResultDataGrid(self, data=self.getData())
        #         bottomResultToolbar = self.constructBottomResultToolBar()

        ####################################################################
        vBox.Add(self.topResultToolbar, 0, wx.EXPAND | wx.ALL, 0)
        vBox.Add(self.resultPanel, 1, wx.EXPAND | wx.ALL, 0)
        vBox.Add(self.bottomResultToolbar, 0, wx.EXPAND | wx.ALL, 0)
        #         vBox.Add(bottomResultToolbar , 0, wx.EXPAND | wx.ALL, 0)
        #         vBox.Add(resultPanel , 1, wx.EXPAND | wx.ALL)
        sizer = wx.BoxSizer(wx.VERTICAL)
        #         sizer.Add(worksheetToolbar ,.9, wx.EXPAND | wx.ALL, 0)
        sizer.Add(vBox, 1, wx.EXPAND, 0)
        self.SetSizer(sizer)
示例#2
0
    def __init__(self,
                 parent,
                 title,
                 size=(350, 420),
                 style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE
                 | wx.SUNKEN_BORDER | wx.STAY_ON_TOP):
        style = style & (~wx.MINIMIZE_BOX)
        wx.Frame.__init__(self, parent, -1, title, size=size, style=style)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        self.SetMinSize((100, 100))
        self.fileOperations = FileOperations()
        # set frame icon
        icon = wx.Icon()
        icon.CopyFromBitmap(
            self.fileOperations.getImageBitmap(imageName='eclipse16.png'))
        self.SetIcon(icon)
        sizer = wx.BoxSizer(wx.VERTICAL)
        #         self.buttonPanel = CreateButtonPanel(self)
        ####################################################################
        self.findAndReplacePanel = FindAndReplacePanel(self)
        ####################################################################

        sizer.Add(self.findAndReplacePanel, 1, wx.EXPAND)
        #         sizer.Add(self.buttonPanel, 0, wx.EXPAND)
        self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyUP)
        self.SetSizer(sizer)
        self.Center()
        #         self.createStatusBar()ut527
        self.Show(True)
    def BuildTreeImageList(self):
        #         imgList = wx.ImageList(16, 16)
        #
        #         for png in _demoPngs:
        #             imgList.Add(catalog[png].GetBitmap())
        #
        #         # add the image for modified demos.
        #         imgList.Add(catalog["custom"].GetBitmap())
        #
        #         self.AssignImageList(imgList)
        if self._il:
            self._il.Destroy()
            self._il = None
        self._il = wx.ImageList(16, 16)
        self.SetImageList(self._il)

        self.ImageList.RemoveAll()
        self.iconsDictIndex = {}
        count = 0
        self.fileOperations = FileOperations()
        for imageName in [
                'preference.png', 'folder.png', 'folder_view.png',
                'fileType_filter.png', 'usb.png', 'stop.png', 'java.png',
                'python_module.png', 'xml.png', 'folderType_filter.png'
        ]:
            self.ImageList.Add(
                self.fileOperations.getImageBitmap(imageName=imageName))
            self.iconsDictIndex[imageName] = count
            count += 1
示例#4
0
    def __init__(self, parent=None, *args, **kw):
        wx.Panel.__init__(self, parent, id=-1)
        self.parent = parent
        self.fileOperations = FileOperations()
        self.tabName = kw['tabName']
        self.dataSourceTreeNode = kw['dataSourceTreeNode']
        self.data = list()
        self.sqlList = dict()
        vBox = wx.BoxSizer(wx.VERTICAL)
        logger.debug(kw)
        ####################################################################
        # adding new rows to the list on click of add button
#         self.newRows={}
        ####################################################################
#         self.topResultToolbar = self.constructTopResultToolBar()
        self.bottomResultToolbar = wx.StatusBar(self)
        self.resultPanel, self.toolbar = self.getPanelByTabName(tableName=kw['tableName'], tabName=kw['tabName'])
#         self.resultPanel = ResultPanel(self, data=None)
        self.bottomResultToolbar.SetStatusText("some text")
#         self.bottomResultToolbar = self.constructBottomResultToolBar()
#         self.resultPanel = ResultDataGrid(self, data=self.getData())
#         bottomResultToolbar = self.constructBottomResultToolBar()
        
        ####################################################################
        vBox.Add(self.toolbar , 0, wx.EXPAND | wx.ALL, 0)
#         vBox.Add(self.resultPanel , 1, wx.EXPAND | wx.ALL, 0)
        vBox.Add(self.resultPanel , 1, wx.EXPAND | wx.ALL)
        vBox.Add(self.bottomResultToolbar , 0, wx.EXPAND | wx.ALL, 0)
#         vBox.Add(bottomResultToolbar , 0, wx.EXPAND | wx.ALL, 0)
        sizer = wx.BoxSizer(wx.VERTICAL)
#         sizer.Add(worksheetToolbar ,.9, wx.EXPAND | wx.ALL, 0)
        sizer.Add(vBox, 1, wx.EXPAND , 0)
        self.SetSizer(sizer)    
示例#5
0
    def __init__(self,
                 parent,
                 Id=wx.ID_ANY,
                 Title="",
                 sqlText=None,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER
                 | wx.STAY_ON_TOP):
        style = style & (~wx.MINIMIZE_BOX)
        wx.Frame.__init__(self, parent, Id, Title, pos, size, style)

        self.fileOperations = FileOperations()
        # set frame icon
        icon = wx.Icon()
        icon.CopyFromBitmap(
            self.fileOperations.getImageBitmap(imageName='eclipse16.png'))
        self.SetIcon(icon)
        sizer = wx.BoxSizer(wx.VERTICAL)
        ####################################################################

        self.sqlQueryPanel = SqlQueryPanel(self, sqlText)
        ####################################################################

        sizer.Add(self.sqlQueryPanel, 1, wx.EXPAND)
        self.BindEvents()
        self.Show(show=True)
    def __init__(self,
                 parent,
                 *args,
                 title="Python Project",
                 subTitle='',
                 imageName='python-wizban.png',
                 selectedPath=None,
                 **kw):
        wx.Panel.__init__(self, parent, id=-1)

        vBox = wx.BoxSizer(wx.VERTICAL)
        hBox = wx.BoxSizer(wx.HORIZONTAL)
        self.SetBackgroundColour(wx.WHITE)
        self.fileOperations = FileOperations()
        headerText = wx.StaticText(self, -1, title, (20, 10))
        font = wx.Font(10, wx.FONTFAMILY_SCRIPT, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_BOLD)
        headerText.SetFont(font)

        subTitleText = wx.StaticText(self, -1, subTitle, (20, 10))

        bmp = self.fileOperations.getImageBitmap(imageName=imageName)
        rightsImage = wx.StaticBitmap(self, -1, bmp, (80, 150))
        vBox1 = wx.BoxSizer(wx.VERTICAL)
        vBox1.Add(headerText, 1, wx.EXPAND | wx.LEFT, 10)
        vBox1.Add(subTitleText, 1, wx.EXPAND | wx.LEFT, 15)
        hBox.Add(vBox1, 1, wx.EXPAND, 0)
        hBox.Add(rightsImage, 0, wx.EXPAND, 0)
        vBox.Add(hBox, 0, wx.EXPAND, 0)
        vBox.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 0)
        self.SetSizer(vBox)
        self.SetAutoLayout(True)
示例#7
0
    def BuildTreeImageList(self):
        if self._il:
            self._il.Destroy()
            self._il = None
        self._il = wx.ImageList(16, 16)
        self.SetImageList(self._il)

        self.ImageList.RemoveAll()
        self.iconsDictIndex = {}
        count = 0
        self.fileOperations = FileOperations()
        imageIconsName = [
            'preference.png', 'folderType_filter.png',
            'eclipse_open_folder.png', 'fileType_filter.png', 'usb.png',
            'stop.png', 'java.png', 'python_module.png', 'xml.png',
            "other_view.png", 'console_view.png', 'register_view.png',
            'debug_view.png', 'history_view.png', 'compare_view.png',
            'breakpoint_view.png', 'watchlist_view.png', 'history_view.png',
            'synch_synch.png', 'variable_view.png', 'internal_browser.png',
            'reflog.png', 'staging.png', 'rebase_interactive.png',
            'repo_rep.png', 'gitrepository.png', 'filenav_nav.png',
            'welcome16.png', 'tasks_tsk.png', 'resource_persp.png',
            'outline_co.png', 'folder_user.png'
        ]
        for item in bookExplorerList:
            imageIconsName.append(item[2])
        for imageName in imageIconsName:
            try:
                self.ImageList.Add(
                    self.fileOperations.getImageBitmap(imageName=imageName))
                self.iconsDictIndex[imageName] = count
                count += 1
            except Exception as e:
                logger.error(e)
示例#8
0
    def BuildTreeImageList(self):
        logger.debug('BuildTreeImageList')
        self.fileOperations = FileOperations()
        imgList = wx.ImageList(16, 16)

        # add the image for modified demos.

        imgList.Add(self.fileOperations.getImageBitmap(imageName="database.png"))  # 0
        imgList.Add(self.fileOperations.getImageBitmap(imageName="database_category.png"))  # 1
        imgList.Add(self.fileOperations.getImageBitmap(imageName="folder_view.png"))  # 2
        imgList.Add(self.fileOperations.getImageBitmap(imageName="folder.png"))  # 3
        imgList.Add(self.fileOperations.getImageBitmap(imageName="table.png"))  # 4
        imgList.Add(self.fileOperations.getImageBitmap(imageName="view.png"))  # 5
        imgList.Add(self.fileOperations.getImageBitmap(imageName="index.png"))  # 6
        imgList.Add(self.fileOperations.getImageBitmap(imageName="column.png"))  # 7 using to show integer column 
        imgList.Add(self.fileOperations.getImageBitmap(imageName="string.png"))  # 8
        imgList.Add(self.fileOperations.getImageBitmap(imageName="key.png"))  # 9
        imgList.Add(self.fileOperations.getImageBitmap(imageName="foreign_key_column.png"))  # 10
        imgList.Add(self.fileOperations.getImageBitmap(imageName="columns.png"))  # 11
        imgList.Add(self.fileOperations.getImageBitmap(imageName="unique_constraint.png"))  # 12
        imgList.Add(self.fileOperations.getImageBitmap(imageName="reference.png"))  # 13
        imgList.Add(self.fileOperations.getImageBitmap(imageName="datetime.png"))  # 14
        imgList.Add(self.fileOperations.getImageBitmap(imageName="columns.png"))  # 15
        imgList.Add(self.fileOperations.getImageBitmap(imageName="sqlite.png"))  # 16
        imgList.Add(self.fileOperations.getImageBitmap(imageName="h2.png"))  # 17 use to show h2 database icon
        imgList.Add(self.fileOperations.getImageBitmap(imageName="textfield.png"))  # 18 use to show [varchar, char, text data] type icon 
        
#         imgList.Add(wx.Bitmap(path2))
#         for png in _demoPngs:
#             imgList.Add(catalog[png].GetBitmap())

        self.AssignImageList(imgList)
    def __init__(self, parent=None, *args, **kw):
        wx.Panel.__init__(self, parent, id=-1)
        self.parent = parent
        vBox = wx.BoxSizer(wx.VERTICAL)
        ####################################################################
        self.fileOperations = FileOperations()
        self.toolbar = self.constructTopToolBar()
        self.tree = DatabaseTree(self)
        self.filter = wx.SearchCtrl(self, style=wx.TE_PROCESS_ENTER)
        self.filter.SetDescriptiveText("Type filter table name")
        self.filter.ShowCancelButton(True)
        #         self.filter.Bind(wx.EVT_TEXT, self.recreateTree)
        self.filter.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN,
                         lambda e: self.filter.SetValue(''))
        #         self.filter.Bind(wx.EVT_TEXT_ENTER, self.OnSearch)
        #         self.recreateTree()

        # add drop target
        self.SetDropTarget(DatabaseFileDropTarget(self))
        #         self.tree.SetExpansionState(self.expansionState)

        ####################################################################
        ####################################################################
        vBox.Add(self.toolbar, 0, wx.EXPAND | wx.ALL)
        vBox.Add(self.filter, 0, wx.EXPAND | wx.ALL)
        vBox.Add(self.tree, 1, wx.EXPAND | wx.ALL)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(vBox, 1, wx.EXPAND, 0)
        self.SetSizer(sizer)
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        WorkspaceHelper.__init__(self)
        pub.subscribe(self.reloadingDatabase, 'reloadingDatabase')
        vBox = wx.BoxSizer(wx.VERTICAL)
        ####################################################################
        self.libraryPath = self.getLibraryPath()
        self.fileDropTarget = FileDropTarget(self, libraryPath=self.libraryPath)
        self.fileOperations = FileOperations()
        self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
        self.search.ShowSearchButton(1)
        self.search.ShowCancelButton(1)
        self.search.SetMenu(None)
        self.search.Bind(wx.EVT_TEXT_ENTER, self.OnSearch)
        self.search.Bind(wx.EVT_TEXT, self.OnSearch)
                
        self.thumbnailCtrl = ThumbnailCtrl(self, -1, imagehandler=NativeImageHandler)
        self.thumbnailCtrl.EnableToolTips(enable=True)
        self.thumbnailCtrl.SetDropTarget(self.fileDropTarget)
#         self.thumbnailCtrl.ShowDir(r'/home/vijay/Pictures')
#         findingBook = FindingBook(libraryPath=r'/docs/new/library')
#         books = findingBook.searchingBook(searchText='head')
        self.page = Page()
        self.loadingBook()
        self.paginationBar = self.constructTopToolBar()
        self.setPaginationBarStatus()
        ####################################################################
        vBox.Add(self.search , 0, wx.EXPAND | wx.ALL)
        vBox.Add(self.thumbnailCtrl , 1, wx.EXPAND | wx.ALL)
        vBox.Add(self.paginationBar , 0, wx.EXPAND | wx.ALL, 0)
#         vBox.Add(self.tree , 1, wx.EXPAND | wx.ALL)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(vBox, 1, wx.EXPAND , 0)
        self.SetSizer(sizer)
示例#11
0
 def loadingData(self, filePath=None, columnNameFirstRow=False, delimiter=",", quotechar='|'):
     head, tail = ntpath.split(filePath)
     tableName = "_".join(tail.split(sep=".")[:-1])
     self.tableNameText.SetValue(tableName)
     fileOperations = FileOperations()
     self.data = fileOperations.readCsvFile(filePath=filePath, columnNameFirstRow=columnNameFirstRow, delimiter=delimiter, quotechar=quotechar)
     self.GetTopLevelParent().resultDataGrid.addData(self.data)
示例#12
0
    def __init__(self,
                 parent,
                 Id=wx.ID_ANY,
                 Title="",
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER
                 | wx.STAY_ON_TOP):
        style = style & (~wx.MINIMIZE_BOX)
        wx.Frame.__init__(self, parent, Id, Title, pos, size, style)

        self.fileOperations = FileOperations()
        #         pub.subscribe(self.__OnCellChange, 'OnCellChange')
        self._mgr = aui.AuiManager()

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

        # set frame icon
        icon = wx.Icon()
        icon.CopyFromBitmap(
            self.fileOperations.getImageBitmap(imageName='eclipse16.png'))
        self.SetIcon(icon)

        # set up default notebook style
        #         self._mgr._autoNBStyle = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
        self._notebook_theme = 0

        self.BuildPanes()
        self.BindEvents()
        self.Show(show=True)
    def BuildTreeImageList(self):
        #         imgList = wx.ImageList(16, 16)
        #
        #         for png in _demoPngs:
        #             imgList.Add(catalog[png].GetBitmap())
        #
        #         # add the image for modified demos.
        #         imgList.Add(catalog["custom"].GetBitmap())
        #
        #         self.AssignImageList(imgList)
        if self._il:
            self._il.Destroy()
            self._il = None
        self._il = wx.ImageList(16, 16)
        self.SetImageList(self._il)

        self.ImageList.RemoveAll()
        self.iconsDictIndex = {}
        count = 0
        self.fileOperations = FileOperations()

        for imageName in [
                'preference.png',
                'folder.png',
                'folder_view.png',
                'fileType_filter.png',
                'usb.png',
                'stop.png',
                'java.png',
                'python_module.png',
                'xml.png',
                "other_view.png",
                'gitrepository.png',
                'jperspective.png',
                'javaee_perspective.png',
                'python_perspective.png',
                'database.png',
                'resource_persp.png',
                'debug_persp.png',
                'jpa.png',
                'web_perspective.png',
                'javascript_perspective.png',
                'plugin_perspecitve.png',
                'svn_perspective.png',
                'remote_perspective.png',
                'browse_persp.png',
                'perspective-planning.png',
                'database_debug_perspective.png',
                'java_type_hierarchy.png',
                'xml_perspective.png',
                'synch_synch.png',
        ]:
            try:
                self.ImageList.Add(
                    self.fileOperations.getImageBitmap(imageName=imageName))
                self.iconsDictIndex[imageName] = count
                count += 1
            except Exception as e:
                logger.error(imageName, e)
示例#14
0
    def __init__(self):
#         bmp = wx.Image(opj("../images/splash.png")).ConvertToBitmap()
        self.fileOperations = FileOperations()
        bmp = self.fileOperations.getImageBitmap(imageName="splash.png")
        SplashScreen.__init__(self, bmp,
                                 wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT,
                                 2000, None, -1)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.fc = wx.CallLater(1, self.ShowMain)
示例#15
0
 def __init__(self, parent, model=None, data=None):
     gridlib.Grid.__init__(self, parent, -1, style=wx.BORDER_NONE)
     self.fileOperations = FileOperations()
     self.CreateGrid(0, 0)
     self.RowLabelSize = 32
     self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.showGridCellPopupMenu)
     self.Bind(gridlib.EVT_GRID_LABEL_RIGHT_CLICK, self.showHeaderPopupMenu)
     self.Bind(wx.EVT_KEY_DOWN, self.OnKey)
     self.Bind(gridlib.EVT_GRID_CELL_CHANGED, self.cellChange) 
     self.data = None
     self.sqlText = ''
示例#16
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
        sizer = wx.BoxSizer(wx.VERTICAL)

        self.searchResult = {
#             1 : ["abc1.py", r"c:\1\asdf"],
#             2 : ["abc2.java", r"c:\1\asdf"],
#             3 : ["abcasdfasdfa3.java", r"c:\1\asdf"],
#             4 : ["abc4.java", r"c:\1\asdf"],
#             5 : ["abc5.properties", r"c:\1\asdf"],
#             6 : ["abc5.md", r"c:\1\asdf"],
#             7 : ["abc5.txt", r"c:\1\asdf"],
        }

        self.fileOperations = FileOperations()
        self.list = ImprovedListCtrl(self, wx.NewIdRef(),
                                style=wx.LC_REPORT
                                # | wx.BORDER_SUNKEN
                                | wx.BORDER_NONE
                                | wx.LC_EDIT_LABELS
                                # | wx.LC_SORT_ASCENDING    # disabling initial auto sort gives a
                               | wx.LC_NO_HEADER  # better illustration of col-click sorting
                                | wx.LC_VRULES
                                | wx.LC_HRULES
                                | wx.LC_SINGLE_SEL
                                )
        self.setImageList()
        self.loadData(items={})
        sizer.Add(self.list, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected, self.list)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, self.list)
        self.Bind(wx.EVT_LIST_DELETE_ITEM, self.OnItemDelete, self.list)
        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self.list)
        self.Bind(wx.EVT_LIST_COL_RIGHT_CLICK, self.OnColRightClick, self.list)
        self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.OnColBeginDrag, self.list)
        self.Bind(wx.EVT_LIST_COL_DRAGGING, self.OnColDragging, self.list)
        self.Bind(wx.EVT_LIST_COL_END_DRAG, self.OnColEndDrag, self.list)
        self.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnBeginEdit, self.list)
        self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEndEdit, self.list)

        self.list.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick)
        self.list.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)

        # for wxMSW
        self.list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)

        # for wxGTK
        self.list.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
示例#17
0
 def __init__(self):
     self.fileOperations = FileOperations()
     self.fileImageExtensionDict = {
         #             '.exe':'exe.png',
         '.xml': 'xml.png',
         '.java': 'jcu_obj.png',
         '.py': 'python_module.png',
         '.html': 'web.png',
         '.md': 'markdown.png',
         '.jar': 'jar_file.png',
         '.yaml': 'yaml.png',
         '.yml': 'yaml.png',
     }
     pass
示例#18
0
class GridCellPopupMenu(wx.Menu):

    def __init__(self, header=None):
        wx.Menu.__init__(self)
        self.fileOperations = FileOperations()

        copyItem = wx.MenuItem(self, wx.NewIdRef(), "Copy")
        copyItem.SetBitmap(self.fileOperations.getImageBitmap(imageName="copy_edit_co.png"))
        copyItemMenu = self.Append(copyItem)
        self.Bind(wx.EVT_MENU, lambda e: self.onCopySelection(e), copyItemMenu)

        pasteItem = wx.MenuItem(self, wx.NewIdRef(), "Paste")
        pasteItem.SetBitmap(self.fileOperations.getImageBitmap(imageName="paste_edit.png"))
        pasteItemMenu = self.Append(pasteItem)
        self.Bind(wx.EVT_MENU, lambda e: self.onPasteSelection(e), pasteItemMenu)

        exportItem = wx.MenuItem(self, wx.NewIdRef(), "Export...")
        exportItem.SetBitmap(self.fileOperations.getImageBitmap(imageName="table_export.png"))
        exportItemMenu = self.Append(exportItem)
        self.Bind(wx.EVT_MENU, self.onExport, exportItemMenu)

        resultSetCountItem = wx.MenuItem(self, wx.NewIdRef(), "Count rows")
        resultSetCountItem.SetBitmap(self.fileOperations.getImageBitmap(imageName="resultset_count.png"))
        resultSetCountItemMenu = self.Append(resultSetCountItem)
        self.Bind(wx.EVT_MENU, self.countRows, resultSetCountItemMenu)

    def onPasteSelection(self, event):
        logger.info('onPasteSelection')
        self.GetWindow().paste()
#         print "Item Two selected in the %s window" % self.WinName

    def onCopySelection(self, event):
        logger.info('onCopySelection')
        self.GetWindow().copy()
#         print "Item Two selected in the %s window" % self.WinName

    def onExport(self, event):
        logger.info('onExport')
#         print "Item Two selected in the %s window" % self.WinName
        pass

    def countRows(self, event):
        logger.info(f'countRows: {self.GetWindow().GetNumberRows()}')
        dlg = wx.MessageDialog(self.GetWindow(), f'Row count :  {self.GetWindow().GetNumberRows()}',
                       'Row Count',
                       wx.OK | wx.ICON_INFORMATION
                       # wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                       )
        dlg.ShowModal()
        dlg.Destroy()
示例#19
0
    def DoSetupImageList(self):
        """Add the images to the control's ImageList. It is guaranteed
        that self.ImageList is valid and empty when this is called.

        """
        logger.debug('DoSetupImageList')
        self.fileOperations = FileOperations()
        bmp = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_MENU, (16, 16))
        self.ImageList.Add(bmp)
        bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_MENU, (16, 16))
        self.ImageList.Add(bmp)
        bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_MENU, (16, 16))
        self.ImageList.Add(bmp)

        iconsPresent = self.getExtensionWithBmp()
        logger.debug(iconsPresent)
        count = 3
        self.iconsDictByIndex = {}
        self.iconsDictByExtension = {}
        for iconInfo in iconsPresent:
            self.ImageList.Add(iconInfo[1])
            iconInfo.append(count)
            self.iconsDictByExtension[iconInfo[0][0]] = iconInfo
            self.iconsDictByIndex[count] = iconInfo
            count = count + 1
        logger.debug(self.iconsDictByIndex)
示例#20
0
    def onDeleteWithDatabaseTable(self, event):
        logger.debug('onDeleteWithDatabaseTable')
#         self.onDeleteConnection(event)
        ##################################################################################
        sqlExecuter = SQLExecuter(database='_opal.sqlite')
        selectedItemId = self.tree.GetSelection()
        selectedItemText = self.tree.GetItemText(self.tree.GetSelection())
        dbFilePath = sqlExecuter.getDbFilePath(selectedItemText)
        logger.debug("dbFilePath: %s", dbFilePath)
        
        ##################################################################################
        fileOperations = FileOperations()
        fileRemoved = fileOperations.removeFile(filename=dbFilePath)
        if selectedItemText and fileRemoved:
            self.sqlExecuter.removeConnctionRow(selectedItemText)
            self.recreateTree()
示例#21
0
class PropertiesBaseTreePanel(ExpansionState, TreeCtrl):
    '''
    Left navigation tree in preferences page
    '''

    def __init__(self, parent):
         
        TreeCtrl.__init__(self, parent, style=wx.TR_DEFAULT_STYLE | 
                               wx.TR_HAS_VARIABLE_ROW_HEIGHT | wx.BORDER_NONE)
        
        self._il = None
        self.BuildTreeImageList()
        
#         if USE_CUSTOMTREECTRL:
#             self.SetSpacing(10)
#             self.SetWindowStyle(self.GetWindowStyle() & ~wx.TR_LINES_AT_ROOT)

        self.SetInitialSize((100, 80))
            
    def AppendItem(self, parent, text, image=-1, wnd=None):

        item = TreeCtrl.AppendItem(self, parent, text, image=image)
        return item
            
    def BuildTreeImageList(self):
#         imgList = wx.ImageList(16, 16)
# 
#         for png in _demoPngs:
#             imgList.Add(catalog[png].GetBitmap())
#             
#         # add the image for modified demos.
#         imgList.Add(catalog["custom"].GetBitmap())
# 
#         self.AssignImageList(imgList)
        if self._il:
            self._il.Destroy()
            self._il = None
        self._il = wx.ImageList(16, 16)
        self.SetImageList(self._il)
        
        self.ImageList.RemoveAll()
        self.iconsDictIndex = {}
        count = 0
        self.fileOperations = FileOperations()
        for imageName in ['preference.png', 'folder.png', 'folder_view.png', 'fileType_filter.png', 'usb.png', 'stop.png',
                          'java.png', 'python_module.png', 'xml.png', 'folderType_filter.png']:
            self.ImageList.Add(self.fileOperations.getImageBitmap(imageName=imageName))
            self.iconsDictIndex[imageName] = count
            count += 1

    def GetItemIdentity(self, item):
        return self.GetItemData(item)

    def Freeze(self):
        if 'wxMSW' in wx.PlatformInfo:
            return super(PropertiesBaseTreePanel, self).Freeze()
                         
    def Thaw(self):
        if 'wxMSW' in wx.PlatformInfo:
            return super(PropertiesBaseTreePanel, self).Thaw()
示例#22
0
    def __init__(self, parent=None, *args, **kw):

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

        #         self.parent = parent
        self.fileOperations = FileOperations()
        sizer = wx.BoxSizer(wx.VERTICAL)

        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)

        self.launchButton = wx.Button(self, -1, "Launch")
        self.Bind(wx.EVT_BUTTON, self.onLaunchClicked, self.launchButton)
        self.launchButton.SetDefault()

        self.cancelButton = wx.Button(self, -1, "Cancel")
        self.Bind(wx.EVT_BUTTON, self.onCancelClicked, self.cancelButton)

        hbox1.Add(self.launchButton)
        hbox1.Add(self.cancelButton)

        sizer.Add(hbox1, 0, wx.ALIGN_RIGHT | wx.RIGHT, 5)
        sizer.Add(hbox2, 0, wx.ALIGN_RIGHT | wx.RIGHT, 5)
        sizer.Add(hbox3, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, 5)
        #         sizer.Add(vBox, 1, wx.EXPAND , 0)
        self.SetAutoLayout(True)
        self.SetSizer(sizer)
示例#23
0
    def GetStyleSheet(sheet_name=None):
        """Finds the current style sheet and returns its path. The
        lookup is done by first looking in the users config directory
        and if it is not found there it looks for one on the system
        level and if that fails it returns None.
        @param sheet_name: style sheet to look for
        @return: full path to style sheet

        """
        if sheet_name:
            style = sheet_name
#         else:
#             style = Profile_Get('SYNTHEME', 'str')
#         style = ebmlib.AddFileExtension(style, u'.ess').lower()
#
#         # Get Correct Filename if it exists
#         for sheet in util.GetResourceFiles(u'styles', trim=False,
#                                            get_all=True, title=False):
#             if sheet.lower() == style:
#                 style = sheet
#                 break

#         user = os.path.join(ed_glob.CONFIG['STYLES_DIR'], style)
#         sysp = os.path.join(ed_glob.CONFIG['SYS_STYLES_DIR'], style)
#         user=sysp=None
#         if os.path.exists(user):
#             return user
#         elif os.path.exists(sysp):
#             return sysp
#         else:

        return FileOperations().getStylePath(styleName="Default.ess")
    def OpenFiles(self, files):
        """Open the list of files in Editra for editing
        @param files: list of file names

        """
        to_open = list()
        for fname in files:
            try:
                res = os.stat(fname)[0]
                if stat.S_ISREG(res) or stat.S_ISDIR(res):
                    to_open.append(fname)
            except (IOError, OSError) as msg:
                logger.debug("[filebrowser][err] %s" % str(msg))

        # TODO : Need to work on it.
        if hasattr(self.GetTopLevelParent(), '_mgr'):

            for path in to_open:
                mainStc = MainStc(self)
                mainStc.SetSavePoint()
                fileName = os.path.split(path)[-1]
                file_ext = fileName.split('.')[-1]
                mainStc.SetFileName(path)
                mainStc.SetText(FileOperations().readFile(filePath=path))
                mainStc.ConfigureLexer(file_ext)
                #                     imageName=self.iconsDictIndex[extensionName]
                self.GetTopLevelParent()._mgr.addTabByWindow(
                    window=mainStc, captionName=fileName, tabDirection=5)
示例#25
0
class MySplashScreen(SplashScreen):

    def __init__(self):
#         bmp = wx.Image(opj("../images/splash.png")).ConvertToBitmap()
        self.fileOperations = FileOperations()
        bmp = self.fileOperations.getImageBitmap(imageName="splash.png")
        SplashScreen.__init__(self, bmp,
                                 wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT,
                                 2000, None, -1)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.fc = wx.CallLater(1, self.ShowMain)

    def OnClose(self, evt):
        # Make sure the default handler runs too so this window gets
        # destroyed
        evt.Skip()
        self.Hide()

        # if the timer is still running then go ahead and show the
        # main frame now
        if self.fc.IsRunning():
            self.fc.Stop()
            self.ShowMain()

    def ShowMain(self):
        frame = EclipseMainFrame(None)
        frame.Show()
        if self.fc.IsRunning():
            self.Raise()
示例#26
0
 def getWindow(self, attachTo, filePath=None):
     window = wx.Panel()
     fileExtension = filePath.split('.')[-1]
     if fileExtension == 'md':
         window = CreatingPandocPanel(attachTo, filePath=filePath)
         #             window.markdownSourcePanel.stc.LoadFile(path=filePath)
         window.markdownSourcePanel.stc.SetFileName(filePath)
         window.markdownSourcePanel.stc.SetModTime(
             os.path.getmtime(filePath))
         #                 mainStc.SetText(FileOperations().readFile(filePath=fileWithImage[0]))
         window.markdownSourcePanel.stc.ConfigureLexer(fileExtension)
         window.markdownSourcePanel.stc.SetModified(False)
         #             imageName = self.iconManager.getFileImageNameByExtension(fileExtension)
         #             (name, captionName) = self.getTitleString(stc=mainStc, path=fileWithImage[0])
         window.markdownSourcePanel.stc.SetSavePoint()
     else:
         window = MainStc(attachTo,
                          text=FileOperations().readFile(filePath=filePath))
         window.SetFileName(filePath)
         window.SetModTime(os.path.getmtime(filePath))
         #                 mainStc.SetText(FileOperations().readFile(filePath=fileWithImage[0]))
         window.ConfigureLexer(fileExtension)
         window.SetModified(False)
         #             imageName = self.iconManager.getFileImageNameByExtension(fileExtension)
         #             (name, captionName) = self.getTitleString(stc=mainStc, path=fileWithImage[0])
         window.SetSavePoint()
     return window
示例#27
0
    def __init__(self, parent):
        wx.grid.Grid.__init__(self, parent, -1, size=(600, 500))

        self.CreateGrid(1, 1)
        self.RowLabelSize = 32
        self.dataTypeList = [("INTEGER", 0), ("VARCHAR", 1), ("TEXT", 2), ("REAL", 3), ("BLOB", 4), ("NUMERIC", 5)]
        self.checkBoxColumns = ['nullable', 'unique', 'primaryKey', 'autoIncrement']
        self.textBoxColumns = ['name', 'defultValue', 'description']
        self.comboBoxList = ['dataType']
        self.iconColumns = [0]
        self.columns = None
        
        self.fileOperations = FileOperations()
        self.addImages()
        
        self.lastSelectedCell = None
        
        self.bindAllEvent()
示例#28
0
    def BuildTreeImageList(self):
        #         imgList = wx.ImageList(16, 16)
        #
        #         for png in _demoPngs:
        #             imgList.Add(catalog[png].GetBitmap())
        #
        #         # add the image for modified demos.
        #         imgList.Add(catalog["custom"].GetBitmap())
        #
        #         self.AssignImageList(imgList)
        if self._il:
            self._il.Destroy()
            self._il = None
        self._il = wx.ImageList(16, 16)
        self.SetImageList(self._il)

        self.ImageList.RemoveAll()
        self.iconsDictIndex = {}
        count = 0
        self.fileOperations = FileOperations()
        imageNameSet = set()
        for data in viewdataList:
            for dx in data:
                if type(dx) == type(list()):
                    for d in dx:
                        imageNameSet.add(d[2])
            imageNameSet.add(data[2])
        imageNameList = list(imageNameSet)

        #         for imageName in ['preference.png', 'folderType_filter.png', 'eclipse_open_folder.png', 'fileType_filter.png', 'usb.png', 'stop.png',
        #                           'java.png', 'python_module.png', 'xml.png', "other_view.png", 'console_view.png', 'register_view.png',
        #                           'debug_view.png' , 'history_view.png', 'compare_view.png', 'breakpoint_view.png', 'watchlist_view.png',
        #                           'history_view.png', 'synch_synch.png', 'variable_view.png', 'internal_browser.png', 'reflog.png', 'staging.png',
        #                           'rebase_interactive.png', 'repo_rep.png', 'gitrepository.png','filenav_nav.png','welcome16.png','tasks_tsk.png',
        #                           'resource_persp.png','outline_co.png']:
        imageNameList.extend(['other_view.png', 'eclipse_open_folder.png'])
        for imageName in imageNameList:
            try:
                self.ImageList.Add(
                    self.fileOperations.getImageBitmap(imageName=imageName))
                self.iconsDictIndex[imageName] = count
                count += 1
            except Exception as e:
                logger.error(e)
示例#29
0
 def __init__(self, parent=None, *args, **kw):
     wx.Panel.__init__(self, parent, id=-1)
     self.parent = parent
     self.fileOperations = FileOperations()
     vBox = wx.BoxSizer(wx.VERTICAL)
     ####################################################################
     ####################################################################
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(vBox, 1, wx.EXPAND, 0)
     self.SetSizer(sizer)
示例#30
0
class SelectWorkspaceFrame(wx.Frame):
    '''
    This is for select workspace
    '''
    def __init__(self,
                 parent,
                 title,
                 titleHead='',
                 subTitle='',
                 size=(550, 400),
                 style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE
                 | wx.SUNKEN_BORDER | wx.STAY_ON_TOP):
        style = style & (~wx.MINIMIZE_BOX)
        self.parent = parent
        wx.Frame.__init__(self, None, -1, title, size=size, style=style)
        self.title = title
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        self.SetMinSize((100, 100))
        self.fileOperations = FileOperations()
        # set frame icon
        icon = wx.Icon()
        icon.CopyFromBitmap(
            self.fileOperations.getImageBitmap(imageName='eclipse16.png'))
        self.SetIcon(icon)
        sizer = wx.BoxSizer(wx.VERTICAL)
        #         self.buttonPanel = CreateButtonPanel(self)
        ####################################################################
        self.newFileFrame = NewFilePanel(self,
                                         title=titleHead,
                                         subTitle=subTitle)
        ####################################################################
        sizer.Add(self.newFileFrame, 1, wx.EXPAND)
        #         sizer.Add(self.buttonPanel, 0, wx.EXPAND)
        self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyUP)
        self.SetSizer(sizer)
        self.Center()
        #         self.createStatusBar()
        self.Show(True)


#         self.Bind(wx.EVT_SIZE, self.OnSize)

    def OnKeyUP(self, event):
        #         print "KEY UP!"
        keyCode = event.GetKeyCode()
        if keyCode == wx.WXK_ESCAPE:
            self.Close()
        event.Skip()

    def OnCloseFrame(self, event):
        self.Destroy()

    def OnSize(self, event):
        hsize = event.GetSize()
        logger.debug(hsize)