Пример #1
0
    def __init__(self, hop_lenght):
        wx.Frame.__init__(self, None, wx.ID_ANY,
                          "Music synchronization player")

        self.panel = wx.Panel(self)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.on_timer)
        self.timer.Start(100)

        self.default_color = wx.ColourDatabase().Find('LIGHT GREY')
        self.hightlight_color = wx.ColourDatabase().Find("AQUAMARINE")

        sp = wx.StandardPaths.Get()
        self.hop_lenght = hop_lenght

        self.playback_sliders = []
        self.rec_medias = []
        self.rec_labels = []

        self.cur_dataset_dir = sp.GetDocumentsDir()
        self.composition_groups = {}
        self.cur_compose = None
        self.cur_alg = None
        self.cur_number_record = None

        self.set_menubar()
        self.set_panel()
        self.panel.GetSizer().Layout()
Пример #2
0
 def OnColor2(self, event):
     cdb = wx.ColourDatabase()
     self.bgColor = cdb.Find('LIGHT GREY')
     self.cellBgColor = cdb.Find('SPRING GREEN')
     self.fgColor = cdb.Find('black')
     self.selColor = cdb.Find('NAVY')
     self.Refresh()
Пример #3
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent=parent, title=title)

        self.Colors = wx.ColourDatabase()

        self.sizer1 = wx.BoxSizer(wx.VERTICAL)

        self.text_box = wx.TextCtrl(
            self, style=wx.TE_MULTILINE)  # Input miltilinea de texto
        self.button_1 = wx.Button(
            self, -1, u"Botón 1", size=(150, -1)
        )  # Boton (se pone una u antes de las comillas para indicar que es un texto unicode)
        self.button_2 = wx.Button(
            self, -1, u"Botón 2", size=(150, -1)
        )  # Boton (se pone una u antes de las comillas para indicar que es un texto unicode)

        # sizer.Add(control, proporcion, flag, borde) el flag es como el estilo
        self.sizer1.Add(self.text_box, 2, wx.EXPAND | wx.ALL, 10)
        self.sizer1.Add(self.button_1, 1, wx.ALIGN_CENTER | wx.ALL, 10)
        self.sizer1.Add(self.button_2, 1, wx.ALIGN_CENTER | wx.ALL, 10)

        #Sizer
        self.SetSizer(self.sizer1)

        #Evento
        self.Bind(
            wx.EVT_BUTTON,
            self.onClick)  # Event handler Bind(Tipo_evento, handler, source)

        self.SetSize((300, 200))
        self.Centre(True)
        self.Show()
Пример #4
0
def initializeColours():
    colourDB = wx.ColourDatabase()
    colourStrs = ["LIGHT BLUE", "GREEN", "GOLD", "SIENNA", "VIOLET",
        "WHEAT", "RED", "DARK GREEN", "DIM GREY", "STEEL BLUE", "ORANGE",
        "YELLOW GREEN", "THISTLE", "WHITE", "CYAN", "CORNFLOWER BLUE"]
    for x in colourStrs:
        brushList.append(wx.Brush(colourDB.Find(x)))
Пример #5
0
    def __init__(self, parent, name, filePath, width=600, height=400):
        wx.Panel.__init__(self, parent, -1)

        self.filePath = filePath
        self.st = wx.StaticText(self, -1, name)
        self.buttonReload = wx.Button(self, -1, "Reload")
        self.Bind(wx.EVT_BUTTON, self.OnReloadPressed, self.buttonReload)
        self.textshow = wx.TextCtrl(self,
                                    -1,
                                    "No File Loaded",
                                    size=(width, height),
                                    style=wx.TE_MULTILINE | wx.TE_RICH2)
        space = 2
        self.column1 = wx.BoxSizer(wx.VERTICAL)
        self.column1.Add(self.st, 0, wx.ALL, space)
        self.column1.Add(self.buttonReload, 0, wx.ALL, space)
        self.Rows = wx.BoxSizer(wx.HORIZONTAL)
        self.Rows.Add(self.column1, 0, wx.ALL, space)
        self.Rows.Add(self.textshow, 0, wx.ALL, space)
        self.SetSizer(self.Rows)

        self.textshow.LoadFile(filePath)

        self.f = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                         wx.FONTWEIGHT_BOLD, False)
        cb = wx.ColourDatabase()
        self.fcolor = cb.Find("YELLOW")
        self.bcolor = cb.Find("BLACK")

        self.textshow.SetBackgroundColour(self.bcolor)
        self.textshow.SetDefaultStyle(wx.TextAttr(self.fcolor, self.bcolor))
        self.textshow.SetStyle(0, self.textshow.GetLastPosition(),
                               wx.TextAttr(self.fcolor, self.bcolor, self.f))
        self.textshow.ShowPosition(self.textshow.GetLastPosition() - 600)
        self.SetAutoLayout(True)
Пример #6
0
 def OnColor1(self, event):
     cdb = wx.ColourDatabase()
     self.bgColor = cdb.Find('white')
     self.cellBgColor = cdb.Find('SKY BLUE')
     self.fgColor = cdb.Find('DARK GREEN')
     self.selColor = cdb.Find('LIME GREEN')
     self.Refresh()
Пример #7
0
    def InitUI(self):
        # load the graphics
        self.bitmaps = {(MAX_TRIES - x):
                        wx.Bitmap(local_filename('hangman-%d.gif' % x),
                                  wx.BITMAP_TYPE_GIF)
                        for x in range(MAX_TRIES + 1)}

        # preset colours
        self.colours = wx.ColourDatabase()

        # create the main panel
        self.panel = wx.Panel(self)

        # create the text field
        self.guessWordText = wx.StaticText(self.panel,
                                           label="C______R",
                                           pos=(20, 20))
        self.guessWordText.SetFont(wx.Font(32, wx.DEFAULT, wx.NORMAL, wx.BOLD))

        # create the bitmap control
        self.image = wx.StaticBitmap(self.panel, pos=(20, 100))

        # create the keyboard
        self.keyboardButtons = self.CreateKeyboardButtons(350, 100, 40, 10, 5)

        # create the menu bar
        self.SetMenuBar(self.CreateMenuBar())

        # create a status bar
        self.CreateStatusBar()

        # reset the game to a valid state
        self.ResetGame()
Пример #8
0
    def __init__(self, *p, **pp):

        wx.Panel.__init__(self, *p, **pp)

        self.txtdis = wx.TextCtrl(self,
                                  -1,
                                  style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
        self.txtdis.SetFont(
            wx.Font(10, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL))

        EVT_CUSTOM_TRACE(self, self.on_trace)

        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(self.txtdis, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()

        cdb = wx.ColourDatabase()
        self.level = dict()
        self.level[CRITICAL] = ("CRITICAL", wx.TextAttr(cdb.Find("RED")))
        self.level[ERROR] = ("ERROR", wx.TextAttr(cdb.Find("VIOLET RED")))
        self.level[WARNING] = ("WARNING", wx.TextAttr(cdb.Find("ORANGE")))
        self.level[INFO] = ("INFO", wx.TextAttr(cdb.Find("BLACK")))
        self.level[DEBUG] = ("DEBUG", wx.TextAttr(cdb.Find("BLUE")))
        self.level[NOTSET] = ("NOTSET", wx.TextAttr(cdb.Find("BLACK")))

        self.file = None
        self.file = open("ctp.log", "w")
Пример #9
0
 def OnColor3(self, event):
     cdb = wx.ColourDatabase()
     self.bgColor = cdb.Find('LIGHT GREY')
     self.cellBgColor = cdb.Find('white')
     self.fgColor = cdb.Find('black')
     self.selColor = cdb.Find('yellow')
     self.Refresh()
Пример #10
0
    def __init__(self, file_name, title="Set Title!"):
        wx.Dialog.__init__(self, None, -1, title)
        if (paths.get_platform() != "mac"):
            co = wx.ColourDatabase().Find("light grey")
            #print co
            #self.SetBackgroundColour(co)
            self.SetBackgroundColour("lightgrey")
        #print self.GetBackgroundColour()

        self.progress_prompt = wx.StaticText(self, -1, "Download progress:")
        if (USE_WINSOUND):
            self.gauge = wx.StaticText(self, -1, "")
        else:
            self.gauge = wx.Gauge(self, -1, range=100)
            self.gauge.SetMinSize((500, -1))

        self.start = wx.Button(self, -1, "Start Download")
        self.cancel = wx.Button(self, -1, "Cancel Download")
        self.help_text = wx.StaticText(self, -1, "")

        grid = wx.FlexGridSizer(3, 1, 5, 5)
        grid.Add(self.progress_prompt)
        grid.Add(self.gauge, flag=wx.EXPAND)
        grid.Add(self.help_text, flag=wx.EXPAND)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.AddStretchSpacer()
        buttons.Add(self.cancel)
        buttons.Add(self.start, flag=wx.LEFT, border=10)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(grid, 1, flag=wx.ALL, border=10)
        sizer.Add(buttons, 0, wx.EXPAND | wx.ALL, border=10)
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.Layout()

        self.start.SetDefault()

        self.Bind(wx.EVT_BUTTON, self.on_start, self.start)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.cancel)

        self.download_bytes, self.dtype, self.version = get_bytes(file_name)

        self.byte_count = len(self.download_bytes)

        if (USE_WINSOUND):
            self.gauge.SetLabel("")
        else:
            self.gauge.SetRange(self.byte_count)
            self.gauge.SetValue(0)

        self.help_text.SetLabel("Download size is %d bytes" %
                                (self.byte_count, ))

        # convert to wav file
        WAV_FILE = os.path.join(paths.get_store_dir(), "program.wav")
        convertWithPause(self.download_bytes, WAV_FILE, DOWNLOAD_PAUSE_MSECS,
                         DOWNLOAD_BYTES_BETWEEN_PAUSES)
Пример #11
0
class W3CColourDatabase(object):
    """ Proxy for the ColourDatabase which allows for finding W3C colors.

        This class is necessary because the wx 'green' is the W3C 'lime',
        and we need some means to lookup the color names since wx has
        only a few hardcoded.

        This class is a proxy because AddColour expects a wx.ColourDatabase
        instance, not an instance of a subclass
    """

    _database = wx.ColourDatabase()

    def __init__(self):
        self._color_names = [
            "aqua",
            "black",
            "blue",
            "fuchsia",
            "gray",
            "green",
            "lime",
            "maroon",
            "navy",
            "olive",
            "purple",
            "red",
            "silver",
            "teal",
            "white",
            "yellow",
        ]

        self.AddColour("aqua", wx.Colour(0, 0xFF, 0xFF, 255))
        self.AddColour("fuchsia", wx.Colour(0xFF, 0, 0xFF, 255))
        self.AddColour("green", wx.Colour(0, 0x80, 0, 255))
        self.AddColour("lime", wx.Colour(0, 0xFF, 0, 255))
        self.AddColour("maroon", wx.Colour(0x80, 0x0, 0, 255))
        self.AddColour("navy", wx.Colour(0x00, 0x0, 0x80, 255))
        self.AddColour("olive", wx.Colour(0x80, 0x80, 0, 255))
        self.AddColour("purple", wx.Colour(0x80, 0x00, 0x80, 255))
        self.AddColour("silver", wx.Colour(0xC0, 0xC0, 0xC0, 255))
        self.AddColour("teal", wx.Colour(0, 0x80, 0x80, 255))

    def AddColour(self, name, color):
        if name not in self._color_names:
            self._color_names.append(name)
        return self._database.AddColour(name, color)

    def Find(self, color_name):
        return self._database.Find(color_name)

    def FindName(self, color):
        for color_name in self._color_names:
            if self.Find(color_name) == color:
                return color_name

        return ""
Пример #12
0
    def SetColor(self):
        global BATTLE_COLOR_FLANKS
        global BATTLE_COLOR_COUNTER

        db = wx.ColourDatabase()

        self.color = db.Find(BATTLE_COLOR_FLANKS[BATTLE_COLOR_COUNTER %
                                                 len(BATTLE_COLOR_FLANKS)])
        BATTLE_COLOR_COUNTER += 1
Пример #13
0
    def __init__(self):

        BE_Object.__init__(self)
        self._type = self.CANVASOBJECT_CITYEVOLUTION
        self.timeRange = [0, 0]
        self.baseSegment = Geometry.Segment2D()
        self.arrow = Geometry.Segment2D()
        self.housesPerYear = 1
        self.groupID = 0
        self.__colorDB = wx.ColourDatabase()
Пример #14
0
    def __init__(self, ctrl):
        logging.StreamHandler.__init__(self)
        self.listctrl = ctrl

        colours = wx.ColourDatabase()
        self.colours = {
            "CRITICAL": colours.Find("RED"),
            "ERROR": colours.Find("MEDIUM VIOLET RED"),
            "WARNING": colours.Find("YELLOW"),
            "INFO": colours.Find("YELLOW GREEN"),
            "DEBUG": colours.Find("MEDIUM GOLDENROD"),
        }
Пример #15
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        # bgcolor = wx.SystemSettings.GetColour(getattr(wx, 'SYS_COLOUR_HIGHLIGHT'))
        cb = wx.ColourDatabase()
        self.tcolor = cb.Find("LIGHT BLUE")
        self.wcolor = cb.Find("BLACK")
        self.font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                            wx.FONTWEIGHT_BOLD, False)
        self.SetBackgroundColour(self.tcolor)
        buttonReload = wx.Button(self, -1, "Reload")
        self.Bind(wx.EVT_BUTTON, self.OnReloadPressed, buttonReload)
        buttonOther = wx.Button(self, -1, "Other")
        buttonTest = wx.Button(self, -1, "Test")
        bsizer1row = wx.BoxSizer(wx.HORIZONTAL)
        bsizer1row.Add(buttonReload, 0, wx.GROW | wx.ALL, 2)
        bsizer1row.Add(buttonOther, 0, wx.GROW | wx.ALL, 2)
        bsizer1row.Add(buttonTest, 0, wx.GROW | wx.ALL, 2)

        f = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, False)
        l1 = wx.StaticText(self, -1, "DPR Log")
        # l1.setDefaultStyle(wx.TextAttr(self.tcolor, self.wcolor,self.font))
        t1 = wx.TextCtrl(self,
                         -1,
                         "Here is for DPR LOG",
                         size=(800, 300),
                         style=wx.TE_MULTILINE | wx.TE_RICH2)

        self.t1 = t1
        self.t1.SetBackgroundColour(self.wcolor)

        space = 3

        sizer = wx.FlexGridSizer(cols=3, hgap=space, vgap=space)
        sizer.AddMany([
            (0, 0),
            bsizer1row,
            (0, 0),
            l1,
            t1,
            (0, 0),
        ])
        border = wx.BoxSizer(wx.VERTICAL)
        border.Add(sizer, 0, wx.ALL, 25)

        testp = fileDisplayPanel(self, "test",
                                 "C:\M2C\EslWebSystem\workdir\log\dprlog.log")
        border.Add(testp, 0, wx.ALL, 25)

        self.SetSizer(border)
        self.SetAutoLayout(True)
Пример #16
0
Файл: wxg.py Проект: chyser/bin
def InitializeDisplay(title, game):
    #-------------------------------------------------------------------------------
    global _gApp, _gMain, _gColorDB

    _gApp = wx.PySimpleApp()
    _gMain = MainFrame(title, game)

    _gColorDB = wx.ColourDatabase()

    _gApp.SetTopWindow(_gMain)
    _gMain.Show(True)

    return _gMain
Пример #17
0
    def __init__(self, parent):
        super(PreviewPanel, self).__init__(parent)
        self.app = wx.GetApp()
        self.open_to = self.scopes = self.scale = self.x_orig = self.y_orig = self.scope_radius = None
        self.measure_to_twips = None
        self.color_db = wx.ColourDatabase()
        self.initialized = False

        self.Bind(wx.EVT_PAINT, self.on_paint)
        self.Bind(wx.EVT_SIZE, self.on_size)

        path = os.path.join(self.app.base_dir, "data", "lorem_ipsum.txt")
        with open(path, "rt") as file_obj:
            self.lorem_ipsum = file_obj.readlines()
Пример #18
0
    def OnInside(self, event):

        if not self.Running:
            self.InsideBtn.SetValue(False)
            return

        btn = event.GetEventObject()
        btnval = btn.GetValue()  # True or False
        #self.DisableButton(btn)

        if btnval:
            # Robot has moved *to* INSIDE
            ShowMessage("Inside/outside button clicked - now INSIDE")
            #clr = wx.ColourDatabase.Find(wx.ColourDatabase(), "AQUAMARINE")
            #clr = wx.ColourDatabase.Find(wx.ColourDatabase(), "YELLOW GREEN")
            #clr = wx.ColourDatabase.Find(wx.ColourDatabase(), "KHAKI")
            #clr = wx.ColourDatabase.Find(wx.ColourDatabase(), "WHEAT")
            clr = wx.ColourDatabase.Find(wx.ColourDatabase(), "SKY BLUE")
            self.InsideBtn.SetBackgroundColour(clr)
            self.InsideBtn.SetToolTip(wx.ToolTip("Robot is INSIDE"))

            #self.InsideBtn.SetLabel("OUTSIDE")
            self.InsideLed.SetBitmap(self.GreenBall)
            # Indicate inside status to the sched process
            subprocess.call(["touch", self.InsideIndicatorFileName],
                            shell=False)
        else:
            # Robot has moved *to* OUTSIDE
            ShowMessage("Inside/outside button clicked - now OUTSIDE")
            clr = wx.ColourDatabase.Find(wx.ColourDatabase(), "GREEN")
            self.InsideBtn.SetBackgroundColour(clr)
            self.InsideBtn.SetToolTip(wx.ToolTip("Robot is OUTSIDE"))
            self.InsideLed.SetBitmap(self.YellowBall)
            # Indicate outside status to the sched process
            subprocess.call(["rm", "-f", self.InsideIndicatorFileName],
                            shell=False)
Пример #19
0
 def OnColorSelect(self, event):
     """ Color Select Button Press """
     # If no Color Name has been specified ...
     if self.txtColorName.GetValue() == "":
         # Get the Color Database
         cdb = wx.ColourDatabase()
         # Check to see if the defined value has a Color Name!  (Unlikely, but it happens occasionally.)
         colName = cdb.FindName(event.GetValue()).capitalize()
         # Enter the name in the Name Edit box
         self.txtColorName.SetValue(colName)
     # Enter the color's values into the appropriate edit boxes.
     self.txtColorHex.SetValue("#%02X%02X%02X" % (event.GetValue()[0], event.GetValue()[1], event.GetValue()[2]))
     self.txtColorRed.SetValue(str(event.GetValue()[0]))
     self.txtColorGreen.SetValue(str(event.GetValue()[1]))
     self.txtColorBlue.SetValue(str(event.GetValue()[2]))
Пример #20
0
    def __init__(self, parent):
        wx.StatusBar.__init__(self, parent, -1)

        self.SetFieldsCount(3)
        # Sets the three fields to be relative widths to each other.
        self.SetStatusWidths([-3, -1, -2])
        self.sizeChanged = False
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        self.ColorA = wx.ColourDatabase.Find(wx.ColourDatabase(), "RED")
        self.ColorB = wx.ColourDatabase.Find(wx.ColourDatabase(), "GREEN")
        self.ColorC = wx.ColourDatabase.Find(wx.ColourDatabase(), "BLACK")
        self.ColorD = wx.ColourDatabase.Find(wx.ColourDatabase(), "WHITE")
        self.ColorE = wx.ColourDatabase.Find(wx.ColourDatabase(), "YELLOW")

        # Field 0 ... just text
        self.SetStatusText("", 0)

        # Field 1 (the second field) - not used

        # Field 2 (the third field) - a clock
        #self.ClockTextCtrl = wx.TextCtrl(self,-1, "Disconnected", style = wx.TE_READONLY)
        self.ClockTextCtrl = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
        self.SetClockTextCtrl("000:00", self.ColorC, self.ColorE)
        self.Reposition()

        # We're going to use a timer to drive a 'clock' in the last
        # field.
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimeTick, self.timer)

        self.StartTime = None

        self.timer.Start(1000)
        self.OnTimeTick(None)
Пример #21
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((400, 300))
        self.button_1 = wx.Button(self, wx.ID_ANY, "button_1")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.change_background, self.button_1)
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update_title)
        self.timer.Start(40)  # in miliseconds

        self.colour_database = wx.ColourDatabase()
Пример #22
0
 def __init__(self, *args, **kwds):
     # begin wxGlade: MyFrame.__init__
     kwds["style"] = wx.DEFAULT_FRAME_STYLE
     kwds["size"] = (500,600)  
     wx.Frame.__init__(self, *args, **kwds)
     self.Colours = wx.ColourDatabase()
     # setup the queue for script processing
     self.maxQueueMembers = 20 
     self.jobQueue = Queue.Queue(self.maxQueueMembers)
     # maintain the pool of added scripts
     self.scriptList = dict()
     
     self.LST_JOBS = wx.ListCtrl(parent=self, size=(500,100), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_HRULES|wx.LC_VRULES)
     self.LST_JOBS.InsertColumn(0,"Test script")
     self.LST_JOBS.InsertColumn(1,"Data file")
     self.LST_JOBS.InsertColumn(2,"Status")
     self.LST_JOBS.InsertColumn(3,"Directory")
     self.CurrentTestPosition = 0    # store the actual position in the queue
     self.processQueue = True
     
     self.TXT_JOB_DESCRIPTION = TextCtrlFileLikeAppend(parent=self , size=(500,200),style=wx.TE_AUTO_SCROLL|wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_LEFT)
     self.TXT_JOB_DESCRIPTION.AppendText("<Description of the jobs>\n")
     self.writer = csv.writer(self.TXT_JOB_DESCRIPTION, delimiter='\t')
     
     self.TXT_STDOUT = TextCtrlFileLikeAppend(parent=self, size=(500,100), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_LINEWRAP)
     sys.stdout = self.TXT_STDOUT
     
     self.TXT_STDOUT.AppendText("<Output of the program>\n")
     
     self.backgndTest = threading.Thread(target=self._runTest)
     self.backgndTest.setDaemon(True)
     #self.backgndTest.start()  
     
     self.PNL_BTNS = wx.Panel(parent=self,id=wx.NewId())
     self.BTN_UP = wx.Button(parent=self.PNL_BTNS,id=wx.ID_UP)
     self.BTN_UP.Enable(False)
     self.BTN_DOWN = wx.Button(parent=self.PNL_BTNS,id=wx.ID_DOWN)
     self.BTN_DOWN.Enable(False)
     self.BTN_DELETE = wx.Button(parent=self.PNL_BTNS,id=wx.ID_DELETE)
     self.BTN_STOP = wx.Button(parent=self.PNL_BTNS,id=wx.ID_STOP)
     self.BTN_RUN = wx.Button(parent=self.PNL_BTNS,id=-1,label = 'Run next')
     
     self.__set_properties()
     self.__do_layout()
     # couple the EVENTS
     self._create_bindings()
     return
Пример #23
0
    def __init__(self, parent, id):
        wx.ListCtrl.__init__(self,
                             parent,
                             id,
                             style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        ListCtrlAutoWidthMixin.__init__(self)
        CheckListCtrlMixin.__init__(self)

        # colors for rows
        colordb = wx.ColourDatabase()
        self.defaultRowColor = self.GetBackgroundColour()
        self.attnRowColor = colordb.Find('MEDIUM GOLDENROD')
        self.failedRowColor = colordb.Find('PLUM')

        self.pluginRemovedFlag = False

        self.createColumns()
Пример #24
0
 def OnInit(self):
     wx.InitAllImageHandlers()
     self.TrackColor = wx.ColourDatabase.Find(wx.ColourDatabase(),
                                              self.TrackColorName)
     self.DrccFrame = DRCCFrame(self, self.TrackName, self.OurPosition,
                                self.TrackColor, self.AutostartURI,
                                self.SchedPgm, self.FifoFileName,
                                self.InsideIndicatorFileName, self.CsvFile,
                                self.MaxProHostname, self.SlowRate,
                                self.ICMPRate)
     self.DrccFrame.Show(True)
     self.SetTopWindow(self.DrccFrame)
     #--#        if self.DrccFrame.errMsgInfo:
     #--#            self.DrccFrame.ErrWin(self.DrccFrame.errMsgInfo[0],
     #--#                                  self.DrccFrame.errMsgInfo[1])
     #--#        self.DrccFrame.errMsgInfo = ()
     return True
Пример #25
0
class W3CColourDatabase(object):
    """ Proxy for the ColourDatabase which allows for finding W3C colors.

        This class is necessary because the wx 'green' is the W3C 'lime',
        and we need some means to lookup the color names since wx has
        only a few hardcoded.

        This class is a proxy because AddColour expects a wx.ColourDatabase
        instance, not an instance of a subclass
    """

    _database = wx.ColourDatabase()

    def __init__(self):
        self._color_names = [
            'aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime',
            'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal',
            'white', 'yellow'
        ]

        self.AddColour('aqua', wx.Colour(0, 0xff, 0xff, 255))
        self.AddColour('fuchsia', wx.Colour(0xff, 0, 0xff, 255))
        self.AddColour('green', wx.Colour(0, 0x80, 0, 255))
        self.AddColour('lime', wx.Colour(0, 0xff, 0, 255))
        self.AddColour('maroon', wx.Colour(0x80, 0x0, 0, 255))
        self.AddColour('navy', wx.Colour(0x00, 0x0, 0x80, 255))
        self.AddColour('olive', wx.Colour(0x80, 0x80, 0, 255))
        self.AddColour('purple', wx.Colour(0x80, 0x00, 0x80, 255))
        self.AddColour('silver', wx.Colour(0xc0, 0xc0, 0xc0, 255))
        self.AddColour('teal', wx.Colour(0, 0x80, 0x80, 255))

    def AddColour(self, name, color):
        if name not in self._color_names:
            self._color_names.append(name)
        return self._database.AddColour(name, color)

    def Find(self, color_name):
        return self._database.Find(color_name)

    def FindName(self, color):
        for color_name in self._color_names:
            if self.Find(color_name) == color:
                return color_name

        return ''
Пример #26
0
    def OnReloadPressed(self, evt):

        f = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, False)
        cb = wx.ColourDatabase()
        fcolor = cb.Find("YELLOW")
        bcolor = cb.Find("BLACK")
        self.t1.SetDefaultStyle(wx.TextAttr(fcolor, bcolor))

        self.t1.LoadFile("C:\M2C\EslWebSystem\workdir\log\dprlog.log")
        #self.t1.SetEditable(False)
        ln = self.t1.GetNumberOfLines()
        print('lines:%d' % self.t1.GetNumberOfLines())
        pos = self.t1.XYToPosition(ln, 0)
        print('pos:%d' % pos)

        self.t1.SetStyle(0, self.t1.GetLastPosition(),
                         wx.TextAttr(fcolor, bcolor, f))
        self.t1.ShowPosition(self.t1.GetLastPosition() - 600)
Пример #27
0
    def __init__(self, params_mgr, win, name, description, data_model,
                 **kargs):
        """
        - import_db and user_db are the dictionaries holding the imported and user-edited
        entries
        - headers is a dict mapping the entry keys to the labels to be displayed
        - order is an ordered list of the entry keys, whose order will be use for the GUI
        """
        ParamsAction.__init__(self, params_mgr, win, name, description,
                              **kargs)

        self._data_model = data_model
        #        self._headers = headers
        #        self._order = order
        self._colourdb = wx.ColourDatabase()
        self._editButton = None
        self._createFromSelection = None
        self._deleteButton = None
        #        self._params = None
        self._table = None
        self._entry_dialog = None
Пример #28
0
    def menu_config(self, event):
        '''user config the Eye by a window, the config will be stored in config file too'''
        self.config_frame = wx.Frame(None,
                                     size=(self.config_window_width,
                                           self.config_window_height),
                                     title='设置',
                                     style=wx.DEFAULT_FRAME_STYLE &
                                     (~wx.RESIZE_BORDER) & (~wx.MAXIMIZE_BOX))
        self.config_frame.SetBackgroundColour(
            wx.ColourDatabase().Find("WHITE"))
        self.config_frame.Centre()
        self.config_frame.Show()
        frame_width, frame_height = self.config_frame.GetSize()

        box = wx.BoxSizer(wx.VERTICAL)
        self.config_frame.SetSizer(box)

        self.config_text = wx.TextCtrl(self.config_frame,
                                       style=wx.TE_MULTILINE)
        text = self.view.config.text()
        if text != None:
            self.config_text.WriteText(text)
        box.Add(self.config_text, 1, wx.EXPAND | wx.ALL, 0)

        button_box = wx.BoxSizer(wx.HORIZONTAL)
        box.Add(button_box, 0)

        accept_button = wx.Button(self.config_frame, label='确定')
        accept_button_width, accept_button_height = accept_button.GetSize()
        accept_button.Bind(wx.EVT_BUTTON, self.config_accept)
        button_box.Add(accept_button, 0, wx.LEFT,
                       frame_width / 2 - accept_button_width - 5)
        cancel_button = wx.Button(self.config_frame, label='取消')
        cancel_button_width, cancel_button_height = accept_button.GetSize()
        cancel_button.Bind(wx.EVT_BUTTON, self.config_cancel)
        button_box.Add(cancel_button, 0, wx.RIGHT,
                       frame_width / 2 - cancel_button_width - 5)
        self.config_frame.Layout()
Пример #29
0
    def __init__(self, eye):
        monitor_width = ctypes.windll.user32.GetSystemMetrics(0)
        monitor_height = ctypes.windll.user32.GetSystemMetrics(1)
        
        View.__init__(self, eye, monitor_width)

        self.app = wx.App(False)
        
        self.frame = wx.Frame(None, 
                size = (monitor_width, monitor_height))
        self.frame.Bind(wx.EVT_ERASE_BACKGROUND, 
                self.erase_background)
        self.frame.ShowFullScreen(True)
        
        box = wx.BoxSizer(wx.VERTICAL)
        self.frame.SetSizer(box)
        
        self.time = wx.StaticText(self.frame)
        font = wx.Font(self.time_font_size, wx.FONTFAMILY_DEFAULT, 
                wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        self.time.SetFont(font)
        self.time.SetBackgroundColour(
                wx.ColourDatabase().Find("WHITE"))
        time_width, time_height = self.time.GetSize()
        time_border = 20
        box.Add(self.time, 0, wx.TOP | wx.CENTER, 20)
        
        self.work = wx.Button(self.frame, label = self.work_text)
        font = wx.Font(self.work_font_size, wx.FONTFAMILY_DEFAULT, 
                wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        self.work.SetFont(font)
        button_width, button_height = self.work.GetSize() 
        box.Add(self.work, 0, wx. wx.TOP | wx.CENTRE , 
                monitor_height / 2 - button_height / 2 - time_height - time_border)
        self.work.Bind(wx.EVT_BUTTON, self.start_work)
        
        self.tray = tray.WindowsTray(self)     
Пример #30
0
    def __init__(self, parent, id):
        super(ComponentTypeView, self).__init__(parent, id, wx.DefaultPosition)

        vbox = wx.BoxSizer(wx.VERTICAL)
        self.parent = parent
        self.selected_part = {}
        self._current_type = None
        self.grid = wx.GridSizer(0, 2, 1, 3)

        self.octopart_lookup_button = wx.Button(self, 311, 'Octopart Lookup')
        self.save_button = wx.Button(self, 312, 'Save Part to Local DB')
        self.localDB_lookup_button = wx.Button(self, 313, 'Local DB Lookup')
        self.save_all_button = wx.Button(self, 314,
                                         'Save All Parts to local DB')
        self.save_all_button.Disable()

        self.qty_text = wx.TextCtrl(self, 301, '', style=wx.TE_READONLY)
        self.refs_text = wx.TextCtrl(self, 302, '', style=wx.TE_READONLY)
        self.fp_text = wx.TextCtrl(self, 303, '', style=wx.TE_READONLY)
        self.value_text = wx.TextCtrl(self, 304, '')
        self.ds_text = wx.TextCtrl(self, 305, '')
        self.de_text = wx.TextCtrl(self, 306, '')
        self.mfr_text = wx.TextCtrl(self, 307, '')
        self.mpn_text = wx.TextCtrl(self, 308, '')
        self.spr_text = wx.TextCtrl(self, 309, '')
        self.spn_text = wx.TextCtrl(self, 310, '')

        # Bind the save and lookup component buttons
        self.save_button.Bind(wx.EVT_BUTTON,
                              self.on_save_to_datastore,
                              id=wx.ID_ANY)
        self.octopart_lookup_button.Bind(wx.EVT_BUTTON,
                                         self.on_octopart_lookup_component,
                                         id=wx.ID_ANY)
        self.save_all_button.Bind(wx.EVT_BUTTON,
                                  self.on_save_all_to_datastore,
                                  id=wx.ID_ANY)
        self.localDB_lookup_button.Bind(wx.EVT_BUTTON,
                                        self.on_localDB_lookup_component,
                                        id=wx.ID_ANY)

        # Set the background color of the read only controls to
        # slightly darker to differentiate them
        for ctrl in (self.qty_text, self.refs_text, self.fp_text):
            ctrl.SetBackgroundColour(wx.ColourDatabase().Find('Light Grey'))

        self._populate_grid()

        # Create fooprint selector box
        fpbox = wx.BoxSizer(wx.VERTICAL)

        fp_label = wx.StaticText(self,
                                 -1,
                                 'Footprints',
                                 style=wx.ALIGN_CENTER_HORIZONTAL)
        self.fp_list = wx.ListBox(self, 330, style=wx.LB_SINGLE)

        fpbox.Add(fp_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND)
        fpbox.Add(self.fp_list, 1, wx.EXPAND)

        self.fp_list.Bind(wx.EVT_LISTBOX, self.on_fp_list, id=wx.ID_ANY)

        # Create Component selector box
        compbox = wx.BoxSizer(wx.VERTICAL)

        comp_label = wx.StaticText(self,
                                   -1,
                                   'Componenents',
                                   style=wx.ALIGN_CENTER_HORIZONTAL)
        self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE)

        compbox.Add(comp_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND)
        compbox.Add(self.comp_list, 1, wx.EXPAND)
        self.comp_list.Bind(wx.EVT_LISTBOX, self.on_comp_list, id=wx.ID_ANY)

        # Lay out the fpbox and compbox side by side
        selbox = wx.BoxSizer(wx.HORIZONTAL)

        selbox.Add(fpbox, 1, wx.EXPAND)
        selbox.Add(compbox, 1, wx.EXPAND)

        # Perform final layout
        vbox.Add(self.grid, 3, wx.EXPAND | wx.ALL, 3)
        vbox.Add(selbox, 3, wx.EXPAND | wx.ALL, 3)

        self.SetSizer(vbox)
        self.Fit()