示例#1
0
    def pulse(self, evt):

        self.movie_load.Pulse()
        self.sub_load.Pulse()
        #to see if pointer has gone from in to out, or vice versa
        self.last = self.current
        rect = wx.Rect(self.GetPosition()[0],
                       self.GetPosition()[1],
                       self.GetSize()[0],
                       self.GetSize()[1])
        ms = wx.GetMouseState()
        pos = ms.GetX(), ms.GetY()
        #ignore if pointer goes out of display area
        if (not wx.GetClientDisplayRect().Contains(pos)):
            return
        #compare pointers last known position and current position
        if (rect.Contains(pos)):
            self.current = IN

        else:
            self.current = OUT
        #ignore show or hide when first started
        if (self.first):
            self.first = False
            return
        if (self.last == OUT and self.current == IN):
            log('show')
            self.show()

        if (self.last == IN and self.current == OUT):
            log('hide')
            self.hide()
示例#2
0
	def set( self, iJpg, triggerInfo, tsJpg, fps=25, editCB=None ):
		self.iJpg = iJpg
		self.triggerInfo = triggerInfo
		self.tsJpg = tsJpg
		self.fps = fps
		self.editCB = editCB
		
		self.kmh = triggerInfo.get('kmh',0.0) or 0.0
		self.mps = self.kmh / 3.6
		self.mph = self.kmh * 0.621371
		self.pps = 2000.0
		
		self.scaledBitmap.SetBitmap( self.getPhoto() )
		
		sz = self.scaledBitmap.GetBitmap().GetSize()
		iWidth, iHeight = sz
		r = wx.GetClientDisplayRect()
		dWidth, dHeight = r.GetWidth(), r.GetHeight()
		if iWidth > dWidth or iHeight > dHeight:
			if float(iHeight)/float(iWidth) < float(dHeight)/float(dWidth):
				wSize = (dWidth, int(iHeight * float(dWidth)/float(iWidth)))
			else:
				wSize = (int(iWidth * float(dHeight)/float(iHeight)), dHeight)
		else:
			wSize = sz
		
		w, h = self.GetSize()
		if w < wSize[0] or h < wSize[1]:
			self.SetSize( wSize )
		self.timestamp.SetLabel( self.ts.strftime('%H:%M:%S.%f')[:-3] )
示例#3
0
    def show(self, text):
        """shows the popup"""

        # create new text
        if hasattr(self, "text"):
            self.text.Destroy()
        popupSize = self.popup.GetSize()
        logoSize = self.logo.GetSize()
        self.text = wx.StaticText(self.panel, -1, text)
        self.text.Bind(wx.EVT_LEFT_DOWN, self.click)
        self.text.Move((logoSize.width + (self.padding * 2), self.padding))
        self.text.SetSize((
            popupSize.width - logoSize.width - (self.padding * 3),
            popupSize.height - (self.padding * 2)
        ))

        # animate the popup
        screen = wx.GetClientDisplayRect()
        self.popup.Show()
        for i in range(1, popupSize.height + 1):
            self.popup.Move((screen.width - popupSize.width, screen.height - i))
            self.popup.SetTransparent(int(float(240) / popupSize.height * i))
            self.popup.Update()
            self.popup.Refresh()
            time.sleep(0.01)
        self.popped = time.time()
示例#4
0
    def __init__(self, session, logger, **kwds):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          style=wx.DEFAULT_FRAME_STYLE & ~(wx.CLOSE_BOX),
                          **kwds)

        self.session = session
        self.logger = logger
        self.stepGenerator = None

        self.SetTitle(session.windowTitle)

        self.exp = ExperimentPanel(self, session, self._onResponseRecorded)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.exp, 0, wx.EXPAND)

        self.SetAutoLayout(True)
        self.SetSizer(sizer)
        sizer.Fit(self)
        sizer.SetSizeHints(self)
        self.Layout()

        darea = wx.GetClientDisplayRect()
        wsize = self.GetSize()
        self.SetPosition((darea[0] + (darea[2] - wsize[0]) / 2,
                          darea[1] + (darea[3] - wsize[1]) / 2))

        self.Bind(EVT_EXECUTE_FUNCTION, self._onExecuteFunction)
def getOverallDisplaysClientSize():
    """
    Estimate the rectangle of the screen real estate with all
    available displays. This assumes that all displays have same
    resolution and are positioned in a rectangular shape.
    """
    global _INITIAL_DISPLAY_CLIENT_SIZE

    # TODO: Find solution for multiple displays with taskbar always visible

    if wx.Display.GetCount() == 1:
        return wx.GetClientDisplayRect()

    # The following may be wrong if taskbar is always visible
    width = 0
    height = 0

    for i in range(wx.Display.GetCount()):
        d = wx.Display(i)

        rect = d.GetGeometry()
        width = max(width, rect.x + rect.width)
        height = max(height, rect.y + rect.height)

    # May workaround a bug
    if (width < 10 or height < 10) and (_INITIAL_DISPLAY_CLIENT_SIZE
                                        is not None):
        return _INITIAL_DISPLAY_CLIENT_SIZE

    return wx.Rect(0, 0, width, height)
示例#6
0
	def SetPreviewSize(self, position = wx.Point(0, 0), size="Full"):
		if size == "Full":
			r = wx.GetClientDisplayRect()
			self.preview_frame_size = r.GetSize()
			self.preview_frame_pos = r.GetPosition()
		else:
			self.preview_frame_size = size
			self.preview_frame_pos = position
示例#7
0
    def createControls(self):
        # Now create the Panel to put the other controls on.
        rect = wx.GetClientDisplayRect()
        panel = wx.Panel(self, size=(rect.width * 0.8, rect.height * 0.75))

        # Create the book reader controls
        # Translators: the label of the table-of-contents tree
        tocTreeLabel = wx.StaticText(panel, -1, _("Table of Contents"))
        self.tocTreeCtrl = wx.TreeCtrl(
            panel,
            size=(280, 160),
            style=wx.TR_TWIST_BUTTONS
            | wx.TR_LINES_AT_ROOT
            | wx.TR_FULL_ROW_HIGHLIGHT
            | wx.TR_SINGLE
            | wx.TR_ROW_LINES,
            name="toc_tree",
        )
        # Translators: the label of the text area which shows the
        # content of the current page
        self.contentTextCtrlLabel = wx.StaticText(panel, -1, _("Content"))
        self.contentTextCtrl = ContentViewCtrl(
            panel,
            size=(200, 160),
            name="content_view",
        )
        self.contentTextCtrl.SetMargins(self._get_text_view_margins())
        self.readingProgressBar = wx.Gauge(panel,
                                           -1,
                                           style=wx.GA_HORIZONTAL
                                           | wx.GA_SMOOTH)

        # Use a sizer to layout the controls, stacked horizontally and with
        # a 10 pixel border around each
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)
        lftSizer = wx.BoxSizer(wx.VERTICAL)
        rgtSizer = wx.BoxSizer(wx.VERTICAL)
        rgtBottomSizer = wx.BoxSizer(wx.HORIZONTAL)
        lftSizer.Add(tocTreeLabel, 0, wx.ALL, 5)
        lftSizer.Add(self.tocTreeCtrl, 1, wx.ALL, 5)
        rgtSizer.Add(self.contentTextCtrlLabel, 0, wx.EXPAND | wx.ALL, 5)
        rgtSizer.Add(self.contentTextCtrl, 1, wx.EXPAND | wx.ALL, 5)
        rgtBottomSizer.Add(self.readingProgressBar, 1, wx.EXPAND | wx.ALL, 1)
        rgtSizer.Add(rgtBottomSizer, 0, wx.ALL | wx.EXPAND, 4)
        mainSizer.Add(lftSizer, 0, wx.ALL | wx.EXPAND, 10)
        mainSizer.Add(rgtSizer, 1, wx.ALL | wx.EXPAND, 10)
        panel.SetSizer(mainSizer)
        panel.Layout()

        # And also use a sizer to manage the size of the panel such
        # that it fills the frame
        sizer = wx.BoxSizer()
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Fit()
        self.SetSize(self.GetSize())
        self.CenterOnScreen(wx.BOTH)
示例#8
0
	def SetBitmap( self, bitmap ):
		sz = bitmap.GetSize()
		if sz != self.bitmapSz:
			if self.bitmapSz is None:
				r = wx.GetClientDisplayRect()
				dWidth, dHeight = r.GetWidth(), r.GetHeight()
				self.SetSize( (int(dWidth*0.85), int(dHeight*0.85)) )
			self.bitmapSz = sz
			self.SetTitle( u'{} {}x{}'.format( _('CrossMgr Video Focus'), *sz ) )
		return self.bitmap.SetBitmap( bitmap )
示例#9
0
    def __init__(self, server_ip, server_port, *args, **kwargs):
        """
        """
        super(PipelineFrame, self).__init__(None, *args, **kwargs)
        logger.debug('Setting up the BioFrame')

        self.component_sizers = {}
        self.component_panels = {}

        self.Bind(wx.EVT_CLOSE, self._on_exit)

        self.settings = settings.Settings()

        self.standard_paths = wx.StandardPaths.Get()

        self.local_data_dir = self.standard_paths.GetUserLocalDataDir().replace('main_gui', 'pipeline')

        if not os.path.exists(self.local_data_dir):
            os.mkdir(self.local_data_dir)

        self._component_panels = []

        self.pipeline_cmd_q = None
        self.pipeline_ret_q = None
        self.pipeline_abort_event = None
        self.pipeline_thread = None
        self.pipeline_server = None

        self.server_ip = server_ip
        self.server_port = server_port

        self._create_layout()

        self.sleep_inhibit = gui_utils.SleepInhibit()
        self.sleep_inhibit.on()
        self._bind_signals()



        client_display = wx.GetClientDisplayRect()
        minsize = (min(400, client_display.Width), min(600, client_display.Height))
        self.SetMinSize(self._FromDIP(minsize))

        self.Fit()

        size = (min(450, client_display.Width), min(600, client_display.Height))
        self.SetSize(self._FromDIP(size))
        self.CenterOnScreen()
        self.Raise()
        self.Show()

        self._on_startup()

        if os.path.exists(self.settings['raw_settings_file']):
            wx.CallAfter(self._start_pipeline)
 def OnShowSettings(self, event):
   if (self.settings_frame is None):
     frame_rect = self.GetRect()
     display_rect = wx.GetClientDisplayRect()
     x_start = frame_rect[0] + frame_rect[2]
     if (x_start > (display_rect[2] - 400)):
       x_start = display_rect[2] - 400
     y_start = frame_rect[1]
     self.settings_frame = SBSettingsFrame(self, -1, "Settings",
       style=wx.CAPTION|wx.MINIMIZE_BOX, pos=(x_start, y_start))
   self.settings_frame.Show()
示例#11
0
 def OnQuit(self, event):
     hwnd = self.GetHandle()
     wp = GetWindowPlacement(hwnd)[4]
     cdr = wx.GetClientDisplayRect()
     #Note: GetPosition() return (-32000, -32000), if window is minimized !!!
     pos = (wp[0] + cdr[0], wp[1] + cdr[1])
     if pos != ConfigData.pos:
         ConfigData.pos = pos
     self.plugin.controlPanel = None
     self.Show(False)
     self.Destroy()
     event.Skip()
示例#12
0
def scale_window_size_for_high_dpi():
    """Scale window size for high DPI devices. This func can be
    called on all operating systems, but scales only for Windows.
    If scaled value is bigger than the work area on the display
    then it will be reduced."""
    (_, _, max_width, max_height) = wx.GetClientDisplayRect().Get()
    width = max_width * float(scaleWidth)
    height = max_height * float(scaleHeight)
    if width > max_width:
        width = max_width
    if height > max_height:
        height = max_height
    return width, height
示例#13
0
def scale_window_size_for_high_dpi(width, height):
    """Scale window size for high DPI devices. This func can be
    called on all operating systems, but scales only for Windows.
    If scaled value is bigger than the work area on the display
    then it will be reduced."""
    (_, _, max_width, max_height) = wx.GetClientDisplayRect().Get()
    # noinspection PyUnresolvedReferences
    (width, height) = cef.DpiAware.Scale((width, height))
    if width > max_width:
        width = max_width
    if height > max_height:
        height = max_height
    return width, height
示例#14
0
 def __init__(self, parent, tables, size=(640, 480), **kwds):
     adopt_init_args(self, locals())
     (x, y, w, h) = tuple(wx.GetClientDisplayRect())
     (width, height) = size
     fig_w = float(width) / 72.0
     fig_h = float(height) / 72.0
     if (fig_w * 72) > (w - 20):
         fig_w = int(math.floor((w - 40) / 72))
     if (fig_h * 72) > (h - 120):
         fig_h = int(math.floor((h - 160) / 72))
     plot_container.__init__(self, parent, (fig_w, fig_h), **kwds)
     self.p = self.figure.add_subplot(111)
     self.plot_type = None
示例#15
0
    def set_ui(self):
        screen_info = wx.GetClientDisplayRect()
        self.SetSize((screen_info[2], screen_info[3]/2))
        self.Centre()

        sizer = wx.GridBagSizer(hgap=5, vgap=5)  # type: wx.GridBagSizer
        # make controllers
        sizer.Add(self.start_button, pos=(0, 0))
        sizer.Add(self.notebook, pos=(1, 0), flag=wx.EXPAND, span=(16, 60))
        sizer.Add(self.authcode_notebook, pos=(1, 60), flag=wx.EXPAND, span=(16, 30))
        sizer.Add(self.log_list, pos=(17, 0), flag=wx.EXPAND, span=(13, 120))
        #
        self.panel.SetSizer(sizer)
        self.panel.Fit()
示例#16
0
 def show_model_controls(self):
     if (self.model_panel is None):
         frame_rect = self.GetParent().GetRect()
         display_rect = wx.GetClientDisplayRect()
         x_start = frame_rect[0] + frame_rect[2]
         if (x_start > (display_rect[2] - 400)):
             x_start = display_rect[2] - 400
         pos = (x_start, frame_rect[1] + 10)
         self.model_panel = wx_tools.ModelControlPanel(
             self,
             -1,
             title="Model controls",
             style=wx.CLOSE_BOX | wx.CAPTION | wx.SYSTEM_MENU,
             pos=pos)
         self.model_panel.Show()
示例#17
0
def initScreenVars():
    global screenWidth, screenHeight, wxDefaultFramePos, wxDefaultFrameSize
    global edWidth, inspWidth, paletteHeight, bottomHeight, underPalette
    global oglBoldFont, oglStdFont, screenX, screenY

    screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
    screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
    if wx.Platform == '__WXMSW__':
        screenX, screenY, screenWidth, screenHeight = wx.GetClientDisplayRect()
        screenHeight -= topMenuHeight
    else:
        screenX, screenY = 0, 0
        # handle dual monitors on Linux
        if float(screenWidth) / float(screenHeight) >= 2.0:
            screenWidth = int(round(screenWidth / 2.0))

        screenWidth = int(screenWidth - verticalTaskbarWidth)
        screenHeight = int(screenHeight - horizontalTaskbarHeight -
                           topMenuHeight)

    if wx.Platform == '__WXMSW__':
        wxDefaultFramePos = wx.DefaultPosition
        wxDefaultFrameSize = wx.DefaultSize
    else:
        wxDefaultFramePos = (int(round(screenWidth / 4.0)),
                             int(round(screenHeight / 4.0)))
        wxDefaultFrameSize = (int(round(screenWidth / 1.5)),
                              int(round(screenHeight / 1.5)))

    edWidth = int(screenWidth * editorScreenWidthPerc - windowManagerSide * 2)
    inspWidth = screenWidth - edWidth + 1 - windowManagerSide * 4
    paletteHeight = paletteHeights[paletteStyle]
    bottomHeight = screenHeight - paletteHeight
    underPalette = paletteHeight + windowManagerTop + windowManagerBottom + topMenuHeight + screenY

    if wx.Platform == '__WXMSW__':
        oglBoldFont = wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.BOLD, False)
        oglStdFont = wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False)
    else:
        oglBoldFont = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, False)
        oglStdFont = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False)
示例#18
0
    def on_initialize(self, event):
        # only respond to size events the user generates
        # I'm not sure of a better way to do this than an IDLE
        # hack
        self.ignoreSizeEvent = 1

        self.x = 0
        self.y = 0
        self.filename = None
        self.bmp = None

        # figure out the maximum usable window size
        # size we can use without overlapping
        # the taskbar
        bgSize = self.size
        bufSize = self.GetClientSize()
        widthDiff = bgSize[0] - bufSize[0]
        heightDiff = bgSize[1] - bufSize[1]
        displayRect = wx.GetClientDisplayRect()
        self.maximizePosition = (displayRect[0], displayRect[1])
        self.maximumSize = (displayRect[2] - widthDiff,
                            displayRect[3] - heightDiff)

        #self.initSizers()
        if len(sys.argv) > 1:
            # accept a file argument on the command-line
            filename = os.path.abspath(sys.argv[1])
            log.info('pictureViewer filename: ' + filename)
            if not os.path.exists(filename):
                filename = os.path.abspath(
                    os.path.join(self.application.startingDirectory,
                                 sys.argv[1]))
            #print filename
            if os.path.isfile(filename):
                self.openFile(filename)

        if self.filename is None:
            self.fitWindow()

        self.visible = True
def getOverallDisplaysClientRect():
    """
    Estimate the rectangle of the screen real estate with all
    available displays. This assumes that all displays have same
    resolution and are positioned in a rectangular shape.
    """
    global _INITIAL_DISPLAY_CLIENT_SIZE

    # TODO: Find solution for multiple displays with taskbar always visible

    if wx.Display.GetCount() == 1:
        return wx.GetClientDisplayRect()

    left = 0
    top = 0
    right = 0  # Actually first position outside of screen to the right
    bottom = 0  # First pos. outside downwards

    for i in range(wx.Display.GetCount()):
        d = wx.Display(i)

        rect = d.GetGeometry()

        dright = rect.x + rect.width
        dbottom = rect.y + rect.height

        left = min(left, rect.x)
        top = min(top, rect.y)
        right = max(right, dright)
        bottom = max(bottom, dbottom)

    width = right - left
    height = bottom - top

    # May workaround a bug
    if (width < 10 or height < 10) and (_INITIAL_DISPLAY_CLIENT_SIZE
                                        is not None):
        return _INITIAL_DISPLAY_CLIENT_SIZE

    return wx.Rect(left, top, width, height)
示例#20
0
    def show(self, text, logo=None):
        """shows the popup"""

        logoWidth = 0
        horizPads = 2
        popupSize = self.popup.GetSize()

        # add logo
        if hasattr(self, "logo"):
            self.logo.Destroy()
        if logo is not None:
            self.logo = logo = wx.Bitmap(logo)
            logoWidth = self.logo.GetSize().width
            wx.StaticBitmap(self.panel, -1,
                            pos=(self._padding,
                                 self._padding)).SetBitmap(self.logo)
            horizPads = 3

        # add text
        if hasattr(self, "text"):
            self.text.Destroy()
        self.text = wx.StaticText(self.panel, -1, text)
        self.text.Move((logoWidth + (self._padding * 2), self._padding))
        self.text.SetSize(
            (popupSize.width - logoWidth - (self._padding * horizPads),
             popupSize.height - (self._padding * 2)))
        self.text.Bind(wx.EVT_LEFT_DOWN, self._click)

        # animate
        screen = wx.GetClientDisplayRect()
        self.visible = True
        self.popup.Show()
        for i in range(1, popupSize.height + 1):
            self.popup.Move(
                (screen.width - popupSize.width, screen.height - i))
            self.popup.SetTransparent(int(240. / popupSize.height * i))
            self.popup.Update()
            self.popup.Refresh()
            time.sleep(.01)
示例#21
0
 def show_map_ctrls (self) :
   if (self.map_panel is None) :
     if (self.model_panel is not None) :
       frame_rect = self.model_panel.GetRect()
       pos = (frame_rect[0], frame_rect[1] + frame_rect[3])
     else :
       frame_rect = self.GetParent().GetRect()
       display_rect = wx.GetClientDisplayRect()
       x_start = frame_rect[0] + frame_rect[2]
       if (x_start > (display_rect[2] - 400)) :
         x_start = display_rect[2] - 400
       y_start = frame_rect[1] + 200
       if (y_start > (display_rect[3] - 200)) :
         y_start = display_rect[3] - 200
       pos = (x_start, y_start)
     self.map_panel = wx_tools.MapControlPanel(
       parent=self,
       id=-1,
       title="Map controls",
       style=wx.CLOSE_BOX|wx.CAPTION|wx.SYSTEM_MENU,
       pos=pos)
     self.map_panel.Show()
示例#22
0
    def __init__(self, parent):
        self.time = 0
        self.first = True
        self.last = IN
        self.current = IN
        self.closing = False
        self.sctive = False
        self.sliding = False
        log('Initializing GUI')
        gui.Frame.__init__(self, parent)
        self.movie_dict = None
        self.movie_found = False
        self.sub_found = False
        self.ext = ''
        #self.sub = None
        self.rect = wx.GetClientDisplayRect()
        self.right = self.rect[0] + self.rect[2]
        self.bottom = self.rect[1] + self.rect[3]

        self.reset()

        self.active = False
        self.color()
        ##### Timer for monitoring open media files
        self.monitor_timer = monitorTimer(self)
        self.monitor_timer.Start(settings['monitor_time'], False)

        self.Show(False)
        ##### Timer to pulse status bars
        self.load_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.pulse, self.load_timer)
        self.load_timer.Start(settings['load_time'], False)

        self.dock()
        self.c = 0
        self.close(None)
        self.tb = TaskBar(None)
示例#23
0
 def __init__(self, parent_frame=None):
     self.w = win32gui
     dw, dh = wx.GetClientDisplayRect().GetBottomRight()
     w, h = (400, 150)
     x = dw - w
     y = dh - h
     statusFrameStyle = wx.DEFAULT_FRAME_STYLE ^ (
         wx.CLOSE_BOX | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX
     ) | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW | wx.FRAME_SHAPED
     wx.Frame.__init__(self,
                       parent_frame,
                       wx.ID_ANY,
                       "Backup Status", (x, y),
                       wx.Size(w, h),
                       style=statusFrameStyle)
     self.panel = wx.Panel(self, wx.ID_ANY)
     self.bSizer1 = wx.BoxSizer(wx.VERTICAL)
     self.m_StatusOutput = wx.TextCtrl(self.panel, wx.ID_ANY,
                                       wx.EmptyString, wx.DefaultPosition,
                                       wx.DefaultSize, wx.TE_MULTILINE)
     self.bSizer1.Add(self.m_StatusOutput, 1, wx.ALL | wx.EXPAND, 5)
     self.panel.SetSizer(self.bSizer1)
     self.panel.Layout()
     self.timer = timer(3)
示例#24
0
    def __init__(self,
                 parent,
                 id=-1,
                 title="EasyAlarmer",
                 pos=wx.DefaultPosition,
                 size=(300, 400),
                 style=wx.CAPTION | wx.MINIMIZE_BOX | wx.CLOSE_BOX
                 | wx.SYSTEM_MENU | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP):
        #style =wx.FRAME_SHAPED | wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP ) :

        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        #self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_ICONIZE, self.OnIconfiy)

        #SysTray Icon Setup
        if hasattr(sys, "frozen") and getattr(sys, "frozen") == "windows_exe":
            exeName = win32api.GetModuleFileName(
                win32api.GetModuleHandle(None))
            self.tbIcon = wx.Icon(exeName, wx.BITMAP_TYPE_ICO)
        else:
            self.tbIcon = wx.Icon("EasyAlarmer.ico", wx.BITMAP_TYPE_ICO)

        self.tb = wx.TaskBarIcon()
        self.tb.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.OnTaskBarRightClick)

        self.SetIcon(self.tbIcon)

        self.tb.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.OnShow)

        wx.EVT_MENU(self.tb, TB_SHOW, self.OnShow)
        wx.EVT_MENU(self.tb, TB_CLOSE, self.OnExit)

        #Setup Timer and TimerList
        self.LastClockTime = wx.DateTime_Now()
        self.ClockInterval = 1
        self.AlamerList = list()

        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.Timer = wx.Timer(self, -1)
        self.Timer.Start(self.ClockInterval * 1000)

        # Create Panel and Buttons
        panel = wx.Panel(self, size=(300, 30))
        panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        panel_sizer.SetMinSize((300, 40))

        self.AddBtn = wx.Button(panel, -1, u"添加")
        self.EditBtn = wx.Button(panel, -1, u"修改")
        self.DelBtn = wx.Button(panel, -1, u"删除")

        self.Bind(wx.EVT_BUTTON, self.OnAddAlarmItem, self.AddBtn)
        self.Bind(wx.EVT_BUTTON, self.OnEditAlarmItem, self.EditBtn)
        self.Bind(wx.EVT_BUTTON, self.OnDelAlarmItem, self.DelBtn)

        #panel_sizer.AddSpacer(80,10)
        panel_sizer.Add(self.AddBtn, 1, wx.ALL | wx.EXPAND, 5)
        panel_sizer.Add(self.EditBtn, 1, wx.ALL | wx.EXPAND, 5)
        panel_sizer.Add(self.DelBtn, 1, wx.ALL | wx.EXPAND, 5)
        panel.SetSizer(panel_sizer)
        panel.Layout()

        #Create Panel and  Analog Clock
        clockPanel = wx.Panel(self, size=(300, 300))
        clockPanelSizer = wx.BoxSizer(wx.HORIZONTAL)
        clockPanelSizer.SetMinSize((300, 300))
        self.clock = ac.AnalogClock(clockPanel, size=(250,250), hoursStyle = ac.TICKS_DECIMAL,clockStyle=ac.SHOW_HOURS_TICKS| \
                                                 ac.SHOW_HOURS_HAND| \
                                                 ac.SHOW_MINUTES_HAND| \
                   ac.SHOW_SECONDS_HAND| \
                                                 ac.SHOW_SHADOWS)
        colour = wx.Colour(128, 0, 0)
        self.clock.SetHandFillColour(colour)
        colour = wx.Colour(179, 0, 89)
        self.clock.SetHandBorderColour(colour)
        self.clock.SetTickFillColour(colour)
        self.clock.SetTickBorderColour(colour)
        #colour = wx.Colour(225, 255, 255)
        #self.clock.SetFaceBorderColour(colour)
        #self.clock.SetBackgroundColour(colour)
        colour = wx.Colour(249, 255, 255)
        self.clock.SetFaceFillColour(colour)
        colour = wx.Colour(255, 213, 213)
        self.clock.SetShadowColour(colour)
        self.clock.SetTickFont(
            wx.Font(10, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.BOLD))

        clockPanelSizer.Add(self.clock, 0, wx.ALL, 25)

        #Create AlarmListCtrl
        self.list = AlarmerListCtrl(self,
                                    -1,
                                    size=(300, 150),
                                    style=wx.LC_REPORT)
        self.list.Bind(wx.EVT_LEFT_DCLICK, self.OnEditAlarmItem, self.list)
        self.list.PopulateList()

        # Use a sizer to layout the controls, stacked vertically and with
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(clockPanelSizer, 0, wx.ALL, 0)
        sizer.Add(self.list, 0, wx.ALL, 0)
        sizer.Add(panel, 0, wx.ALL, 0)
        self.SetSizerAndFit(sizer)

        width, height = self.GetSizeTuple()
        dispSize = wx.GetClientDisplayRect()
        newPos = wx.Point()
        newPos.x = dispSize.width - width - 1
        newPos.y = (dispSize.height - height) / 2
        self.SetPosition(newPos)
示例#25
0
def 程序_取屏幕工作区矩形():
    '取屏幕工作区矩形(不包含任务栏宽高),格式:(0,0,1920,1040) 任务栏占了40'
    return wx.GetClientDisplayRect()
示例#26
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, name="main_window")
        self.setFrameIcon()

        self.reader = EBookReader(self)
        MenubarProvider.__init__(self)
        ToolbarProvider.__init__(self)
        StateProvider.__init__(self)
        self.CreateStatusBar()

        # Now create the Panel to put the other controls on.
        rect = wx.GetClientDisplayRect()
        panel = wx.Panel(self, size=(rect.width * 0.8, rect.height * 0.75))

        # Create the book reader controls
        # Translators: the label of the table-of-contents tree
        tocTreeLabel = wx.StaticText(panel, -1, _("Table of Contents"))
        self.tocTreeCtrl = wx.TreeCtrl(
            panel,
            size=(280, 160),
            style=wx.TR_TWIST_BUTTONS
            | wx.TR_NO_LINES
            | wx.TR_FULL_ROW_HIGHLIGHT
            | wx.TR_ROW_LINES,
            name="toc_tree",
        )
        # Translators: the label of the text area which shows the
        # content of the current page
        self.contentTextCtrlLabel = wx.StaticText(panel, -1, _("Content"))
        self.contentTextCtrl = wx.TextCtrl(
            panel,
            size=(200, 160),
            style=wx.TE_READONLY
            | wx.TE_MULTILINE
            | wx.TE_RICH2
            | wx.TE_AUTO_URL
            | wx.TE_PROCESS_ENTER
            | wx.TE_NOHIDESEL,
            name="content_view",
        )
        self.contentTextCtrl.Bind(wx.EVT_CONTEXT_MENU, lambda e: e.Skip(False),
                                  self.contentTextCtrl)
        self.contentTextCtrl.Bind(wx.EVT_RIGHT_UP,
                                  self.onContentTextCtrlContextMenu,
                                  self.contentTextCtrl)
        self.contentTextCtrl.SetMargins(self._get_text_view_margins())

        # Use a sizer to layout the controls, stacked horizontally and with
        # a 10 pixel border around each
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)
        lftSizer = wx.BoxSizer(wx.VERTICAL)
        rgtSizer = wx.BoxSizer(wx.VERTICAL)
        lftSizer.Add(tocTreeLabel, 0, wx.ALL, 5)
        lftSizer.Add(self.tocTreeCtrl, 1, wx.ALL, 5)
        rgtSizer.Add(self.contentTextCtrlLabel, 0, wx.EXPAND | wx.ALL, 5)
        rgtSizer.Add(self.contentTextCtrl, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(lftSizer, 0, wx.ALL | wx.EXPAND, 10)
        mainSizer.Add(rgtSizer, 1, wx.ALL | wx.EXPAND, 10)
        panel.SetSizer(mainSizer)
        panel.Layout()

        # And also use a sizer to manage the size of the panel such
        # that it fills the frame
        sizer = wx.BoxSizer()
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Fit()
        self.SetMinSize(self.GetSize())
        self.CenterOnScreen(wx.BOTH)

        # Bind Events
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onTOCItemClick,
                  self.tocTreeCtrl)

        # Set statusbar text
        # Translators: the text of the status bar when no book is currently open.
        # It is being used also as a label for the page content text area when no book is opened.
        self._no_open_book_status = _("Press (Ctrl + O) to open an ebook")
        self.SetStatusText(self._no_open_book_status)
        NavigationProvider(
            ctrl=self.contentTextCtrl,
            reader=self.reader,
            zoom_callback=self.onTextCtrlZoom,
        )
        if config.conf["general"]["play_page_note_sound"]:
            reader_page_changed.connect(play_sound_if_note, sender=self.reader)
        if config.conf["general"]["highlight_bookmarked_positions"]:
            reader_page_changed.connect(highlight_bookmarked_positions,
                                        sender=self.reader)
示例#27
0
# CRISTIAN ECHEVERRÍA RABÍ

from cer.application import Application, AppIni
import wx
import rxfile

#-----------------------------------------------------------------------------------------

name = "AppBase"
version = "0.1.0"
copyright = u"Cristian Echeverría"

#-----------------------------------------------------------------------------------------
# Application

app = Application(name, version, copyright)
app.register("cerapp")
app.resman = rxfile.resman

#-----------------------------------------------------------------------------------------
# User options

_x, _y, _w, _h = wx.GetClientDisplayRect()

ini = AppIni(app.toAppDir("%s.ini" % name))
ini.addSection("app")
ini.addInt("app.width", 900, vmin=600, vmax=_w)
ini.addInt("app.height", 700, vmin=400, vmax=_h)
ini.load(create=True)

app.ini = ini
示例#28
0
  def __init__( self, container, id = -1, **kwargs ):
    self.assemblyAddr = ( -1, -1, -1 )
    self.auxNodeAddrs = []
    self.auxSubAddrs = []
    #self.axialValue = DataModel.CreateEmptyAxialValue()
    self.axialValue = AxialValue()
    self.curDataSet = None
    self.curSize = None
#    self.dataSetDialog = None
#    self.dataSetOrder = []  # list of DataSetName
    self.dataSetSelections = {}  # keyed by DataSetName
    self.dataSetTypes = set()
		#-- keyed by DataSetName
    self.dataSetValues = {}

    self.fluenceAddr = FluenceAddress()
    self.nodeAddr = -1
    self.subAddr = ( -1, -1 )
    self.timeValue = -1.0

#		-- Controls
#		--
    self.attrView = None
    self.headerCtrl = None
    self.listCtrl = None
    self.splitterWindow = None

#		-- Fonts
#		--
    client_rect = wx.GetClientDisplayRect()
    font_pt_size = \
        18  if client_rect.Width >= 1600 else \
        16  if client_rect.Width >= 1280 else \
        14  if client_rect.Width >= 1024 else \
	12
#    label_font_params = dict(
#	family = wx.FONTFAMILY_ROMAN,
#	pointSize = font_pt_size,
#	style = wx.FONTSTYLE_NORMAL,
#	weight = wx.FONTWEIGHT_NORMAL
#        )
#    value_font_params = dict( label_font_params )

    if Config.IsWindows():
#      self.nameCharCount = 20
      self.valueCharCount = 12  # 16
      font_pt_size = int( font_pt_size * 0.8 )
#      label_font_params[ 'faceName' ] = 'Lucida Sans'
#      value_font_params[ 'faceName' ] = 'Courier New'
#      label_font_params[ 'pointSize' ] = \
#      value_font_params[ 'pointSize' ] = font_pt_size
#      label_font_params[ 'weight' ] = \
#      value_font_params[ 'weight' ] = wx.FONTWEIGHT_BOLD
#    else:
##      self.nameCharCount = 12  # 14
#      self.valueCharCount = 8
#      #value_font_params[ 'family' ] = wx.FONTFAMILY_TELETYPE
#      value_font_params[ 'faceName' ] = 'Courier New'

#    self.labelFont = wx.Font( **label_font_params )
#    self.valueFont = wx.Font( **value_font_params )

    screen_ppi = wx.ScreenDC().GetPPI()
    self.pixPerChar = 72 * font_pt_size / screen_ppi[ 0 ]

    super( TableView, self ).__init__( container, id )
示例#29
0
    def CreateApplet(self):
        r = wx.GetClientDisplayRect()
        position = (r.top, r.right)
        window = wx.PopupTransientWindow(self.frame, flags=wx.BORDER_NONE)
        fw = servicewall.ServiceWall()
        yielder = fw.yield_logs(limit=LOG_LIMIT)
        panel = wx.Panel(window)
        i = 0
        panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        icons = []
        labels = []
        logs_by_port = {}

        # First sort logs by port :
        for log in yielder:
            if log["DPT"] not in logs_by_port:
                logs_by_port[log["DPT"]] = [
                    log,
                ]
            else:
                logs_by_port[log["DPT"]].append(log)

        # Then display them :
        status_sizer = wx.BoxSizer(wx.VERTICAL)
        logs_sizer = wx.GridSizer(len(logs_by_port) + 1, 4, 0, 0)
        status_label = wx.StaticText(panel, label="", style=wx.ALIGN_CENTER)
        status_details = wx.StaticText(panel,
                                       label="\nrealm : %s" % fw.realm_id,
                                       style=wx.ALIGN_CENTER)
        if fw.config["enabled"]:
            status_str = "enabled"
        else:
            status_str = "disabled"
        status_label.SetLabelMarkup("<big>ServiceWall\n%s</big>" %
                                    (status_str))
        status_sizer.Add(status_label, 1, wx.ALIGN_CENTER, 25)
        status_sizer.Add(status_details, 1, wx.ALIGN_CENTER, 25)
        panel_sizer.Add(status_sizer, 1, wx.ALIGN_CENTER, 5)
        panel_sizer.Add(logs_sizer, 1, wx.ALL, 20)
        image = wx.Image(TRAY_ICON2, type=wx.BITMAP_TYPE_ANY).Scale(32, 32)
        bitmap = wx.Bitmap(image)
        logs_sizer.Add(wx.StaticText(panel, label=""))
        logs_sizer.Add(wx.StaticText(panel, label='port'), 1, wx.ALIGN_RIGHT,
                       0)
        logs_sizer.Add(wx.StaticText(panel, label="hits"), 1, wx.ALIGN_RIGHT,
                       0)
        logs_sizer.Add(wx.StaticText(panel, label="age"), 1, wx.ALIGN_RIGHT, 0)
        for name, logpile in logs_by_port.items():
            date = logpile[0]["LOG_DATE"]
            delta = date.now() - date
            if delta.seconds <= 60:
                age = str(delta.seconds) + "'"
            else:
                age = ":".join(str(delta).split(".")[0].split(":")[0:2])
            #rawbitmap = wx.Bitmap(TRAY_ICON2, type=wx.BITMAP_TYPE_ANY)
            #bitmap = wx.Bitmap(rawbitmap.ConvertToImage().Rescale(40, 40))
            icons.append(wx.StaticBitmap(panel, -1, bitmap))
            labels.append([
                wx.StaticText(panel,
                              label="%s" % logpile[0]["DPT"],
                              style=wx.ALIGN_RIGHT),
                wx.StaticText(panel, label="%i" % len(logpile)),
                wx.StaticText(panel, label="%s" % age)
            ])
            logs_sizer.Add(icons[i], 1, wx.ALL, 0)
            logs_sizer.Add(labels[i][0], 1, wx.ALIGN_RIGHT, 25)
            logs_sizer.Add(labels[i][1], 1, wx.ALIGN_RIGHT, 0)
            logs_sizer.Add(labels[i][2], 1, wx.ALIGN_RIGHT, 0)
            #for j in range(3):
            #    logs_sizer.Add(labels[i][j], 6)
            i += 1
        panel.SetSizer(panel_sizer)
        panel.SetAutoLayout(True)
        panel_sizer.Fit(panel)
        window.SetPosition((r.right - panel_sizer.Size[0] + 1, r.top))
        window.SetSize(panel_sizer.Size)
        #window.Show(True)
        window.Popup()
        return window