Exemplo n.º 1
0
 def __init__(self, parent, filename=None):
     """Create EditorShellNotebook instance."""
     wx.Notebook.__init__(self, parent, id=-1)
     usePanels = True
     if usePanels:
         editorparent = editorpanel = wx.Panel(self, -1)
         shellparent = shellpanel = wx.Panel(self, -1)
     else:
         editorparent = self
         shellparent = self
     self.buffer = Buffer()
     self.editor = Editor(parent=editorparent)
     self.buffer.addEditor(self.editor)
     self.buffer.open(filename)
     self.shell = Shell(parent=shellparent,
                        locals=self.buffer.interp.locals,
                        style=wx.CLIP_CHILDREN | wx.SUNKEN_BORDER)
     self.buffer.interp.locals.clear()
     if usePanels:
         self.AddPage(page=editorpanel, text='Editor', select=True)
         self.AddPage(page=shellpanel, text='Shell')
         # Setup sizers
         editorsizer = wx.BoxSizer(wx.VERTICAL)
         editorsizer.Add(self.editor.window, 1, wx.EXPAND)
         editorpanel.SetSizer(editorsizer)
         editorpanel.SetAutoLayout(True)
         shellsizer = wx.BoxSizer(wx.VERTICAL)
         shellsizer.Add(self.shell, 1, wx.EXPAND)
         shellpanel.SetSizer(shellsizer)
         shellpanel.SetAutoLayout(True)
     else:
         self.AddPage(page=self.editor.window, text='Editor', select=True)
         self.AddPage(page=self.shell, text='Shell')
     self.editor.setFocus()
     wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
Exemplo n.º 2
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)
        ID = wx.NewId()
        self.notebook_1 = wx.Notebook(self, ID,
                                      style=0)  ######create blank notebook
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, ID, self.page_change)
        wx.EVT_CLOSE(self, self.OnCloseWindow)

        #create Menu Bar
        self.create_menu()

        #create statusbar
        self.frame_1_statusbar = self.CreateStatusBar(3)

        #Create Tool Bar
        self.__generate_toolbar()
        self.__set_properties()
        self.__do_layout()

        #get info for windosize
        sizefile = open(files['size'],
                        "r")  ##open the file to set the window size
        sizelist = sizefile.readlines()
        x = replace(sizelist[0], "\\n", "")
        y = replace(sizelist[1], "\\n", "")
        sizefile.close()
        self.SetSize((int(x), int(y)))
        self.new_document("")
Exemplo n.º 3
0
    def __init__(self,parent,id,port):
        wx.Notebook.__init__(self,parent,id,wx.DefaultPosition, style=wx.SIMPLE_BORDER|wx.NB_TOP)
        self.m_port = port
        self.init()

        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
        wx.EVT_NOTEBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
Exemplo n.º 4
0
 def __init__(self, parent):
     """Create EditorNotebook instance."""
     wx.Notebook.__init__(self, parent, id=-1, style=wx.CLIP_CHILDREN)
     wx.EVT_NOTEBOOK_PAGE_CHANGING(self, self.GetId(),
                                   self.OnPageChanging)
     wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(),
                                  self.OnPageChanged)
     wx.EVT_IDLE(self, self.OnIdle)
Exemplo n.º 5
0
    def __init__(self,parent,id,page,portfolio,matrix):
        wx.Notebook.__init__(self,parent,id,style=wx.SIMPLE_BORDER|wx.NB_TOP)
        self.m_portfolio = portfolio
        self.m_matrix = matrix
        self.m_parent = parent
        self.init(parent)

        # events
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, id, self.OnPageChanged)
        wx.EVT_NOTEBOOK_PAGE_CHANGING(self, id, self.OnPageChanging)
        wx.EVT_ERASE_BACKGROUND(self,self.OnEraseBackground)
Exemplo n.º 6
0
    def __init__(self, parent, site, id=wx.NewId()):
        wx.Notebook.__init__(self, parent, id)

        # The site is the top-level frame containing this notebook.
        self.site = site

        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)

        # Handle changed/changing events to properly activate panels.
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, id, self.OnChanged)
        wx.EVT_NOTEBOOK_PAGE_CHANGING(self, id, self.OnChanging)
Exemplo n.º 7
0
 def CreatePages(self):
     self.nb = wx.Notebook(self, -1)
     self.nb.pages = []
     i = -1
     for p in nb_pages:
         i = i + 1
         page = p[1](self.nb, self, self.debug + (not not self.debug))
         self.nb.AddPage(page, p[0])
         self.nb.pages.append(page)
         self.pagedict[p[0]] = i
     self.nb.SetSelection(0)
     wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.nb.GetId(), self.OnPageChanged)
Exemplo n.º 8
0
    def Init(self, res):
        from pytripgui import __version__ as pytripgui_version

        self.leftmenu_panel = XRCCTRL(self, "leftmenu_panel")
        self.main_notebook = XRCCTRL(self, "main_notebook")
        self.statusbar = XRCCTRL(self, "statusbar")
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, XRCID("main_notebook"),
                                     self.main_notebook_active_page_changed)

        sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.leftmenu = LeftMenuTree(self.leftmenu_panel,
                                     -1,
                                     size=(200, -1),
                                     style=wx.ALL | wx.EXPAND
                                     | wx.TR_DEFAULT_STYLE | wx.TR_EDIT_LABELS)
        sizer.Add(self.leftmenu, 1, wx.EXPAND, 0)
        self.leftmenu_panel.SetSizer(sizer)
        self.data = PytripData()
        self.res = res
        self.bind_menu()
        self.bind_toolbar()
        self.load_settings()

        pub.subscribe(self.on_patient_load, "patient.load")
        pub.subscribe(self.on_import_path_change, "general.import")
        pub.subscribe(self.statusbar_updated, "statusbar.update")
        pub.sendMessage("settings.value.request", "general.import.dicom_path")
        pub.sendMessage("settings.value.request",
                        "general.import.voxelplan_path")
        pub.sendMessage("settings.value.request",
                        "general.import.tripexec_path")

        pub.subscribe(self.load_dialog, "gui")

        self.res = XmlResource(util.get_resource_path('panels.xrc'))

        self.welcome_title = XRCCTRL(self, "m_staticText8")
        self.welcome_version = XRCCTRL(self, "m_staticText12")
        self.welcome_intro = XRCCTRL(self, "m_staticText11")
        self.welcome_disclaimer = XRCCTRL(self, "m_staticText6")

        self.welcome_title.SetLabel("Welcome to PyTRiPGUI")
        self.welcome_intro.SetLabel("")
        disclaimer = "THIS PROGRAM AND INFORMATION ARE PROVIDED \"AS IS\" " + \
                     "WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT " + \
                     "LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A " + \
                     "PARTICULAR PURPOSE. THIS CODE IS NOT CERTIFIED FOR RADIATION THERAPY IN ANY WAY " + \
                     "AND MAY UNDER NO CIRCUMSTANCE BE USED FOR SUCH PURPOSES!\n"
        self.welcome_disclaimer.SetLabel(disclaimer)
        vstr = "Version: " + pytripgui_version + "\n"
        self.welcome_version.SetLabel(vstr)
Exemplo n.º 9
0
    def __init__(self, parent, wxId, id, style):
        # The formatted tab area style uses another widget entirely.
        if style == TabArea.STYLE_FORMATTED:
            raise Exception('not supported here')

        # Create the appropriate widget.
        if style == TabArea.STYLE_ICON:
            w = wx.Listbook(parent, wxId, style=wx.LB_LEFT)
            w.GetListView().SetSingleStyle(wx.LC_AUTOARRANGE)
        elif style == TabArea.STYLE_HORIZ_ICON:
            w = wx.Listbook(parent, wxId, style=wx.LB_TOP)
        elif style == TabArea.STYLE_BASIC:
            w = wx.Notebook(parent, wxId)
        else:
            w = wx.Choicebook(parent, wxId, style=wx.CHB_TOP)

        base.Widget.__init__(self, w)

        self.style = style

        # The horizontal icon style is handled like the normal icon
        # style.
        if self.style == TabArea.STYLE_HORIZ_ICON:
            self.style = TabArea.STYLE_ICON

        # The IconTabs widget remembers its id so it can send
        # notifications events.
        self.widgetId = id

        # The panel map is used when figuring out the IDs of each page
        # when an event occurs.  It contains an ordered array of
        # tuples: (identifier, panel).
        self.panelMap = []
        self.tabAreas = {}

        if self.style == TabArea.STYLE_ICON:
            wx.EVT_LISTBOOK_PAGE_CHANGED(parent, wxId, self.onTabChange)
            # The icon style uses the icons.
            w.SetImageList(wg.iconManager.getImageList())
        elif style == TabArea.STYLE_BASIC:
            wx.EVT_NOTEBOOK_PAGE_CHANGED(parent, wxId, self.onTabChange)
        else:
            wx.EVT_CHOICEBOOK_PAGE_CHANGED(parent, wxId, self.onTabChange)
Exemplo n.º 10
0
    def __init__(self, *args, **kwargs):
        MyFrame.__init__(self, *args, **kwargs)

        # map option flags to checkboxes
        self.flagmapper = {
            FLAGIGNORE: self.IgnoreCheckBox,
            FLAGMULTILINE: self.MultilineCheckBox,
            FLAGLOCALE: self.LocaleCheckBox,
            FLAGDOTALL: self.DotAllCheckBox,
            FLAGUNICODE: self.UnicodeCheckBox,
            FLAGVERBOSE: self.VerboseCheckBox
        }

        self.SetTitle(" " + self.GetTitle() + " " + __version__)

        # set empty pages for HTML windows
        self.MatchesWindow.SetPage("")
        self.HelpWindow.SetPage("")
        self.HelpWindow.SetWindowStyleFlag(wx.SUNKEN_BORDER)

        self.Notebook.SetSelection(0)
        self.RegexBox.Clear()

        # bind events
        wx.EVT_BUTTON(self, ID_EVALUATE, self.evaluate)
        wx.EVT_CLOSE(self, self.close)
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, ID_NOTEBOOK, self.changePage)
        wx.EVT_COMBOBOX(self, ID_HELPCOMBOBOX, self.showhelp)

        # apply settings
        self.loadSettings()

        # move focus to regex input field
        self.RegexBox.SetFocus()

        # initialize needed attribs
        self.matches = []  # list of found matches

        self.path = os.path.split(
            sys.argv[0])[0] or os.getcwd()  # remembers where Kiki is located
        self.doc_path = "/usr/share/doc/kiki"
Exemplo n.º 11
0
    def __init__(self, parent=None):
        wx.Frame.__init__(self,
                          parent,
                          title="Map Editor",
                          style=wx.DEFAULT_FRAME_STYLE)

        self.ShowFullScreen(True)

        self.__statusbar = self.CreateStatusBar(
        )  # A StatusBar in the bottom of the window
        # File menu.
        filemenu = wx.Menu()
        #filemenu.Append(widgets.ID_EDITOR_NEWMAP, "&New map","Crea un nuevo mapa")
        #filemenu.AppendSeparator()
        filemenu.Append(widgets.ID_EDITOR_EXIT, "E&xit",
                        "Terminate the program")
        # Help menu.
        helpmenu = wx.Menu()
        helpmenu.Append(widgets.ID_EDITOR_ABOUT, "&About",
                        "Information about this program")
        # Creating the menubar.
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu, "&File")
        menuBar.Append(helpmenu, "&Help")

        self.SetMenuBar(menuBar)
        wx.EVT_MENU(self, widgets.ID_EDITOR_EXIT, self.OnExit)
        wx.EVT_MENU(self, widgets.ID_EDITOR_ABOUT, self.OnAbout)

        self.notebook = wx.Notebook(self,
                                    widgets.ID_EDITOR_NOTEBOOK,
                                    style=wx.NB_TOP)
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, widgets.ID_EDITOR_NOTEBOOK,
                                     self.OnPageChanged)

        self.__levelManagerPage = LevelsManagerPage(self.notebook,
                                                    self.CreateNewLevelPage,
                                                    self.ChangePageName,
                                                    self.__statusbar)
        self.notebook.AddPage(self.__levelManagerPage, "Levels Manager")
Exemplo n.º 12
0
    def __init__(self, parent, locals={}):
        wx.Notebook.__init__(self, parent, id=-1)

        self.buffers = {}
        self.buffer = None
        self.editor = None

        ShellPanel = wx.Panel(self, -1)

        self.Shell = ireShell(ShellPanel, -1, style=wx.CLIP_CHILDREN | wx.SUNKEN_BORDER,
            introText='Welcome to the IRE Shell.\nCtrl-Up for history!', locals=locals)

        self.AddPage(page=ShellPanel, text='*Shell*', select=True)

        ShellPanelSizer = wx.BoxSizer(wx.VERTICAL)
        ShellPanelSizer.Add(self.Shell, 1, wx.EXPAND)
        ShellPanel.SetSizer(ShellPanelSizer)
        ShellPanel.SetAutoLayout(True)

        self.Shell.SetFocus()

        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
Exemplo n.º 13
0
    def __init__(self, parent, id=-1):
        """Initialize a DataWindow object."""
        # Start with a Dialog Box (wxPython)
        wx.Dialog.__init__(self,
                           parent,
                           id,
                           _("Data"),
                           self.__pos(),
                           self.__size(),
                           style=wx.CAPTION | wx.RESIZE_BORDER)

        # Set "Window Variant" to small only for Mac to use small icons
        if "__WXMAC__" in wx.PlatformInfo:
            self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        vSizer = wx.BoxSizer(wx.VERTICAL)

        # add a Notebook Control to the Dialog Box
        # The wxCLIP_CHILDREN style allegedly reduces flicker.
        self.nb = wx.Notebook(self, -1, style=wx.CLIP_CHILDREN)
        # Set the Notebook's background to White.  Otherwise, we get a visual anomoly on OS X with wxPython 2.9.4.0.
        self.nb.SetBackgroundColour(wx.Colour(255, 255, 255))

        # Let the notebook remember it's parent
        self.nb.parent = self
        vSizer.Add(self.nb, 1, wx.EXPAND)

        # Create tabs for the Notebook Control.  These tabs are complex enough that they are
        # instantiated as separate objects.

        self.DBTab = DatabaseTreeTab(self.nb)

        # Initialize the remaining Tabs to None for the moment
        self.DataItemsTab = None
        self.SelectedDataItemsTab = None
        self.KeywordsTab = None

        # Add the tabs to the Notebook Control
        self.nb.AddPage(self.DBTab, _("Database"), True)

        # OSX requires this for some reason or else it won't have a default
        # page selected.
        self.nb.SetSelection(0)

        # Handle Key Press Events
        self.nb.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        self.SetSizer(vSizer)
        self.SetAutoLayout(True)
        self.Layout()

        # If we are using the Multi-User Version ...
        if not TransanaConstants.singleUserVersion:
            # ... check to see if the Database is using SSL
            #     and select the appropriate graphic file ...
            if TransanaGlobal.configData.ssl:
                bitmap = TransanaImages.locked.GetBitmap()
            else:
                bitmap = TransanaImages.unlocked.GetBitmap()
            # Place a graphic on the screen.  This is NOT placed in the Sizer, but is placed on top of the notebook tabs.
            self.sslDBImage = wx.StaticBitmap(self,
                                              -1,
                                              bitmap,
                                              pos=(self.nb.GetSizeTuple()[0] -
                                                   32, 0),
                                              size=(16, 16))
            # Make the SSL Indicator clickable
            self.sslDBImage.Bind(wx.EVT_LEFT_DOWN, self.OnSSLClick)

            # ... check to see if both the Database and the Message Server are using SSL
            #     and select the appropriate graphic file ...
            if TransanaGlobal.configData.ssl and TransanaGlobal.chatIsSSL:
                bitmap = TransanaImages.locked.GetBitmap()
            else:
                bitmap = TransanaImages.unlocked.GetBitmap()
            # Place a graphic on the screen.  This is NOT placed in the Sizer, but is placed on top of the notebook tabs.
            self.sslImage = wx.StaticBitmap(self,
                                            -1,
                                            bitmap,
                                            pos=(self.nb.GetSizeTuple()[0] -
                                                 16, 0),
                                            size=(16, 16))
            # Make the SSL Indicator clickable
            self.sslImage.Bind(wx.EVT_LEFT_DOWN, self.OnSSLClick)
            # Remember the current SSL Status of the Message Server
            self.sslStatus = TransanaGlobal.configData.ssl and TransanaGlobal.chatIsSSL

        self.ControlObject = None  # The ControlObject handles all inter-object communication, initialized to None

        # Capture Size Changes
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_PAINT(self, self.OnPaint)

        if DEBUG:
            print "DataWindow.__init__():  Initial size:", self.GetSize()

        # Capture the selection of different Notebook Pages
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.nb.GetId(),
                                     self.OnNotebookPageSelect)
Exemplo n.º 14
0
 def __init__(self, parent):
     wx.Notebook.__init__(self, parent, -1)
     self.parent = parent
     wx.EVT_NOTEBOOK_PAGE_CHANGED(self, -1, self.OnPageChanged)