""" A simple GUI for iterating through potential error areas created by the ConfidenceScoreCompiler. Owner: Doug Perkowski Copyright (c) 2002-2012 OC3 Entertainment, Inc. """ import wx import FxStudio from FxAnimation import * import subprocess MENU_ID = wx.NewId() DIALOG_TITLE = "Confidence Analyzer" STATIC_TEXT_MESSAGE = u'Find text or analysis errors' # The amount to pad start times (to make sure we see the beginning of the # problem area) START_PADDING = .25 def createFrame(commandEvent, errorAreas): # Passing in FxStudio.getMainWindowNotebook() as the parent does not prevent # a crash on close if the plugin GUI was not closed first. Instead, we use # the appshutdown callback to clean up the plugin. See the __init__ and # __del__ functions. frame = ConfidenceScoreGUI(None, errorAreas)
def createframe(self): #绑定窗口的关闭事件 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) # 小区ID id_cell = wx.StaticText(self.panel, -1, u'小区ID:') self.id_cell_t = wx.TextCtrl(self.panel, -1, "0", style=wx.TE_READONLY) # 系统带宽 bandwidth = wx.StaticText(self.panel, -1, u'系统带宽:') self.bandwidth_t = wx.TextCtrl(self.panel, -1, "0", style=wx.TE_READONLY) #实时载波频率偏差值 cfo_st = wx.StaticText(self.panel, -1, u"实时载波频率偏差:") self.cfo = wx.TextCtrl(self.panel, -1, "0", style=wx.TE_READONLY) #实时细定时误差 fte_st = wx.StaticText(self.panel, -1, u"实时细定时误差:") self.fte = wx.TextCtrl(self.panel, -1, "0", style=wx.TE_READONLY) #峰值位置 pss_pos_st = wx.StaticText(self.panel, -1, u"峰值位置:") self.pss_pos = wx.TextCtrl(self.panel, -1, "0", style=wx.TE_READONLY) #主同步状态是否锁定 pss_status_st = wx.StaticText(self.panel, -1, u"主同步状态:\t\t\t") self.pss_status = PanelOne(self.panel) #辅同步状态是否锁定 sss_status_st = wx.StaticText(self.panel, -1, u"辅同步状态:\t\t\t") self.sss_status = PanelOne(self.panel) #pbch是否找到 pbch_status_st = wx.StaticText(self.panel, -1, u"pbch是否找到:\t\t\t") self.pbch_status = PanelOne(self.panel) #当前处理状态 process_state_st = wx.StaticText(self.panel, -1, u"处理状态(捕获/跟踪):\t\t\t") self.process_state = PanelOne(self.panel) #MAC_PDU个数、误帧率、帧号、子帧号 # status_bar_lable = "MAC_PDU个数:\t\t\t误帧率:\t" # self.status_bar = wx.TextCtrl(self.panel, -1, status_bar_lable, style=wx.TE_READONLY) mac_pdu = wx.StaticText(self.panel, -1, u"mac_pdu的个数:\t") self.mac_pdu_value = wx.StaticText(self.panel, -1, '') frame_error_rate = wx.StaticText(self.panel, -1, u"误帧率:\t") self.frame_error_rate_value = wx.StaticText(self.panel, -1, '') fn_st = wx.StaticText(self.panel, -1, u"帧号:\t") self.fn = wx.StaticText(self.panel, -1, '') sfn_st = wx.StaticText(self.panel, -1, u"子帧号:\t") self.sfn = wx.StaticText(self.panel, -1, '') #连接按钮 self.connect_button = wx.Button(self.panel, -1, u"连接") self.connect_button.SetBackgroundColour('black') self.connect_button.SetForegroundColour('white') self.Bind(wx.EVT_BUTTON, self.OnConnect, self.connect_button) # self.connect_button.SetDefault() #设置连接服务器的IP地址和端口号 self.terminal_config.read("terminal.conf") try: s_ip = self.terminal_config.get("address", "s_ip") except: s_ip = '192.168.139.180' try: s_port = self.terminal_config.get("address", "s_port") except: s_port = '7000' ip_st = wx.StaticText(self.panel, -1, u"IP地址 :") self.IPText = wx.TextCtrl(self.panel, -1, s_ip) port_st = wx.StaticText(self.panel, -1, u"端口号 :") self.PortText = wx.TextCtrl(self.panel, -1, s_port) #######开始布局############ sizer1 = wx.FlexGridSizer(cols=2, hgap=10, vgap=10) sizer1.AddGrowableCol(1) sizer1.Add(id_cell, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer1.Add(self.id_cell_t, 0, wx.EXPAND) sizer1.Add(bandwidth, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer1.Add(self.bandwidth_t, 0, wx.EXPAND) sizer1.Add(pss_pos_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer1.Add(self.pss_pos, 0, wx.EXPAND) sizer1.Add(fte_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer1.Add(self.fte, 0, wx.EXPAND) sizer1.Add(cfo_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer1.Add(self.cfo, 0, wx.EXPAND) sizer11 = wx.FlexGridSizer(cols=2, hgap=10, vgap=10) sizer11.AddGrowableCol(1) sizer11.Add(pss_status_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer11.Add(self.pss_status, 0, wx.EXPAND) sizer11.Add(sss_status_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer11.Add(self.sss_status, 0, wx.EXPAND) sizer11.Add(pbch_status_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer11.Add(self.pbch_status, 0, wx.EXPAND) sizer11.Add(process_state_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer11.Add(self.process_state, 0, wx.EXPAND) sizer111 = wx.FlexGridSizer(cols=4, hgap=10, vgap=10) sizer111.AddGrowableCol(1) sizer111.AddGrowableCol(3) sizer111.Add(frame_error_rate, 0, wx.ALIGN_CENTER_VERTICAL) sizer111.Add(self.frame_error_rate_value, 0, wx.EXPAND) sizer111.Add(mac_pdu, 0, wx.ALIGN_CENTER_VERTICAL) sizer111.Add(self.mac_pdu_value, 0, wx.EXPAND) sizer111.Add(fn_st, 0, wx.ALIGN_CENTER_VERTICAL) sizer111.Add(self.fn, 0, wx.EXPAND) sizer111.Add(sfn_st, 0, wx.ALIGN_CENTER_VERTICAL) sizer111.Add(self.sfn, 0, wx.EXPAND) sizer2 = wx.StaticBoxSizer(wx.StaticBox(self.panel, wx.NewId(), u'状态显示'), wx.VERTICAL) sizer2.Add(sizer1, 0, wx.EXPAND | wx.ALL, 10) sizer2.Add(wx.StaticLine(self.panel), 0,wx.EXPAND|wx.TOP|wx.BOTTOM,10) sizer2.Add(sizer11, 0, wx.EXPAND | wx.ALL, 10) sizer2.Add(wx.StaticLine(self.panel), 0,wx.EXPAND|wx.TOP|wx.BOTTOM,10) sizer2.Add(sizer111, 0, wx.EXPAND | wx.ALL, 10) sizer3 = wx.FlexGridSizer(cols=2, hgap=10, vgap=10) sizer3.AddGrowableCol(1) sizer3.Add(ip_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer3.Add(self.IPText, 3, wx.EXPAND) sizer3.Add(port_st, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sizer3.Add(self.PortText, 1, wx.EXPAND) #连接按钮 sizer4 = wx.BoxSizer(wx.HORIZONTAL) sizer4.Add((20,20), 1) sizer4.Add(self.connect_button, 0, wx.ALIGN_RIGHT) sizer5 = wx.StaticBoxSizer(wx.StaticBox(self.panel, wx.NewId(), u'连接服务器'), wx.VERTICAL) sizer5.Add(sizer3, 0, wx.EXPAND | wx.ALL, 10) sizer5.Add(sizer4, 0, wx.EXPAND | wx.ALL, 10) box1 = wx.BoxSizer(wx.VERTICAL) box1.Add(sizer2,0,wx.EXPAND | wx.ALL, 25) box1.Add(wx.StaticLine(self.panel), 0,wx.EXPAND|wx.TOP|wx.BOTTOM,0) box1.Add(sizer5,0,wx.EXPAND | wx.ALL | wx.BOTTOM, 25) #自动调整界面尺寸 self.panel.SetSizer(box1)
IGNORE_COLOUR = wx.Colour(140, 100, 160) # gray-violet WARNING_COLOUR = wx.Colour(240, 190, 45) # orange OK_COLOUR = wx.Colour(25, 160, 50) # green # --------------------------------------------------------------------------- # GUI design. MIN_PANEL_W = 180 MIN_PANEL_H = 220 MIN_FRAME_W = 720 MIN_FRAME_H = 540 # ---------------------------------------------------------------------------- ID_ANNOTATIONS = wx.NewId() ID_COMPONENTS = wx.NewId() ID_PLUGINS = wx.NewId() ID_ACTIONS = wx.NewId() ID_FILES = wx.NewId() ID_EXT_BUG = wx.NewId() ID_EXT_HOME = wx.NewId() ID_FEEDBACK = wx.NewId() ID_FRAME_DATAROAMER = wx.NewId() ID_FRAME_SNDROAMER = wx.NewId() ID_FRAME_IPUSCRIBE = wx.NewId() ID_FRAME_SPPASEDIT = wx.NewId() ID_FRAME_STATISTICS = wx.NewId() ID_FRAME_DATAFILTER = wx.NewId()
# Local Imports import handlers import cfgdlg # Editra Libraries import ed_glob import util from profiler import Profile_Get, Profile_Set import ed_msg import eclib.ctrlbox as ctrlbox import eclib.outbuff as outbuff import eclib.platebtn as platebtn #-----------------------------------------------------------------------------# # Globals ID_SETTINGS = wx.NewId() ID_EXECUTABLE = wx.NewId() ID_ARGS = wx.NewId() ID_RUN = wx.NewId() # Profile Settings Key LAUNCH_KEY = 'Launch.Config' #LAUNCH_PREFS = 'Launch.Prefs' # defined in cfgdlg # Custom Messages MSG_RUN_LAUNCH = ('launch', 'run') # Value reqest messages REQUEST_ACTIVE = 'Launch.IsActive' _ = wx.GetTranslation
#! /usr/bin/python """The main script for the RunSnakeRun profile viewer""" import wx, sys, os, logging from gettext import gettext as _ import pstats from squaremap import squaremap from runsnakerun import pstatsloader if sys.platform == 'win32': windows = True else: windows = False log = logging.getLogger('runsnake.main') ID_OPEN = wx.NewId() ID_EXIT = wx.NewId() ID_PACKAGE_VIEW = wx.NewId() ID_PERCENTAGE_VIEW = wx.NewId() ID_ROOT_VIEW = wx.NewId() ID_BACK_VIEW = wx.NewId() ID_UP_VIEW = wx.NewId() ID_DEEPER_VIEW = wx.NewId() ID_SHALLOWER_VIEW = wx.NewId() class PStatsAdapter(squaremap.DefaultAdapter): def value(self, node, parent=None): if isinstance(parent, pstatsloader.PStatGroup): if parent.cummulative: return node.cummulative / parent.cummulative else:
self.data = [] self.editors = [] [ ID_EDITINGPANEL, ID_EDITINGPANELADDBUTTON, ID_EDITINGPANELINDEXCHOICE, ID_EDITINGPANELINDEXLIST, ID_EDITINGPANELINDEXLISTPANEL, ID_EDITINGPANELPARTLIST, ID_EDITINGPANELSECONDSPLITTER, ID_EDITINGPANELSUBINDEXGRID, ID_EDITINGPANELSUBINDEXGRIDPANEL, ID_EDITINGPANELCALLBACKCHECK, ] = [wx.NewId() for _init_ctrls in range(10)] [ ID_EDITINGPANELINDEXLISTMENUITEMS0, ID_EDITINGPANELINDEXLISTMENUITEMS1, ID_EDITINGPANELINDEXLISTMENUITEMS2, ] = [wx.NewId() for _init_coll_IndexListMenu_Items in range(3)] [ ID_EDITINGPANELMENU1ITEMS0, ID_EDITINGPANELMENU1ITEMS1, ID_EDITINGPANELMENU1ITEMS3, ID_EDITINGPANELMENU1ITEMS4, ] = [wx.NewId() for _init_coll_SubindexGridMenu_Items in range(4)]
def __init__(self, *args, **kwds): # begin wxGlade: MainFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.main_frame_menubar = wx.MenuBar() global ID_DOC ID_DOC = wx.NewId() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_EXIT, "Exit", "", wx.ITEM_NORMAL) self.main_frame_menubar.Append(wxglade_tmp_menu, "File") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_ABOUT, "About", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_DOC, "Documentation", "", wx.ITEM_NORMAL) self.main_frame_menubar.Append(wxglade_tmp_menu, "Help") self.SetMenuBar(self.main_frame_menubar) # Menu Bar end self.label_source = wx.StaticText(self, -1, "Source:") self.combo_box_source = wx.ComboBox(self, -1, choices=["demo_files"], style=wx.CB_DROPDOWN) self.button_source_file = wx.Button(self, -1, "Select File...") self.button_source_folder = wx.Button(self, -1, "Select Folder...") self.label_dest = wx.StaticText(self, -1, "Destination:") self.combo_box_dest = wx.ComboBox(self, -1, choices=["demo_output"], style=wx.CB_DROPDOWN) self.button_dest_file = wx.Button(self, -1, "Select File...") self.button_dest_folder = wx.Button(self, -1, "Select Folder...") self.button_scan = wx.Button(self, -1, "Scan") self.button_clean = wx.Button(self, -1, "Scan and Clean") self.grid_results = wx.grid.Grid(self, -1, size=(1, 1)) self.list_results = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES | wx.SUNKEN_BORDER) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.quit, id=wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.about, id=wx.ID_ABOUT) self.Bind(wx.EVT_MENU, self.display_doc, id=ID_DOC) self.Bind(wx.EVT_BUTTON, self.select_source_file, self.button_source_file) self.Bind(wx.EVT_BUTTON, self.select_source_dir, self.button_source_folder) self.Bind(wx.EVT_BUTTON, self.select_dest_file, self.button_dest_file) self.Bind(wx.EVT_BUTTON, self.select_dest_dir, self.button_dest_folder) self.Bind(wx.EVT_BUTTON, self.scan, self.button_scan) self.Bind(wx.EVT_BUTTON, self.clean, self.button_clean) # end wxGlade # disabled grid ## self.grid_results = wx.grid.Grid(self, -1, size=(1, 1)) # set list columns self.list_results.InsertColumn(col=0, heading='File') self.list_results.InsertColumn(col=1, heading='Result') self.list_results.InsertColumn(col=2, heading='Details')
def get_id(self): id = wx.NewId() self._menu_ids.append(id) return id
class ActionManager: ID_JOB_QUEUE = wx.NewId() ID_PROJECT_CLOSE = wx.NewId() ID_LANG_EN = wx.NewId() ID_LANG_FR = wx.NewId() ID_LANG_DE = wx.NewId() ID_LANG_PT_BR = wx.NewId() ID_LANG_CS = wx.NewId() ID_LANG_IT = wx.NewId() ID_LANG_KO = wx.NewId() ID_LANG_NL = wx.NewId() ID_LANG_RU = wx.NewId() ID_LANG_TA = wx.NewId() ID_LANG_UK = wx.NewId() ID_LANG_EL = wx.NewId() LANG_MAP = { ID_LANG_EN: "en", ID_LANG_FR: "fr", ID_LANG_DE: "de", ID_LANG_CS: "cs", ID_LANG_IT: "it", ID_LANG_KO: "ko", ID_LANG_NL: "nl", ID_LANG_RU: "ru", ID_LANG_PT_BR: "pt_BR", ID_LANG_TA: "ta", ID_LANG_UK: "uk", ID_LANG_EL: "el" } def __init__(self, frame, menuBar, toolBar): self._frame = frame self._menuBar = menuBar self._toolBar = toolBar self._prevEditor = None self._toolFix = 0 menuFile = self.__CreateMenuFile() menuEdit = self.__CreateMenuEdit() menuHelp = self.__CreateMenuHelp() self._menuBar.Append(menuFile, _(u'&File')) self._menuBar.Append(menuEdit, _(u'&Edit')) self._menuBar.Append(menuHelp, _(u'&Help')) self.__MakeToolBar(toolBar) self.__SelectLanguage(Settings().GetLanguage()) def __SelectLanguage(self, lang): for ident, l in self.LANG_MAP.items(): if l == lang: self._menuBar.Check(ident, True) def __MakeToolBar(self, toolBar): toolBar.AddTool(wx.ID_NEW, "", wx.ArtProvider.GetBitmap('PFS_PROJECT_NEW_24'), kind=wx.ITEM_DROPDOWN, shortHelp=_(u'New Slideshow')) toolBar.Bind(wx.EVT_TOOL_DROPDOWN, self.OnDropDownNew) toolBar.AddTool(wx.ID_OPEN, "", wx.ArtProvider.GetBitmap('PFS_PROJECT_OPEN_24'), _(u'Load'),) toolBar.AddTool(wx.ID_SAVE, "", wx.ArtProvider.GetBitmap('PFS_PROJECT_SAVE_24'), wx.ArtProvider.GetBitmap('PFS_PROJECT_SAVE_D_24'), wx.ITEM_NORMAL, shortHelp=_(u'Save')) # toolBar.AddSimpleTool(wx.ID_SAVEAS, # wx.ArtProvider.GetBitmap('PFS_PROJECT_SAVEAS_16'), # _(u'Save Project as'), _(u'Save Project as')) toolBar.AddSeparator() toolBar.AddTool(self.ID_JOB_QUEUE, '', wx.ArtProvider.GetBitmap('PFS_JOB_QUEUE_24'), wx.ArtProvider.GetBitmap('PFS_JOB_QUEUE_D_24'), wx.ITEM_NORMAL, _(u'Show job queue'), _(u'Show job queue'), None) toolBar.AddSeparator() self._toolFix = toolBar.GetToolsCount() toolBar.Realize() def __CreateMenuNew(self): menu = wx.Menu() CreateMenuItem(menu, wx.ID_NEW, _(u'Slideshow') + '\tCtrl+N', wx.ArtProvider.GetBitmap('PFS_PROJECT_NEW_16')) return menu def __CreateMenuFile(self, editor=None): menu = wx.Menu() menu.Append(wx.ID_ANY, _(u'New'), self.__CreateMenuNew()) CreateMenuItem(menu, wx.ID_OPEN, _(u'&Open') + '\tCtrl+O', wx.ArtProvider.GetBitmap('PFS_PROJECT_OPEN_16')) menu.AppendSeparator() CreateMenuItem(menu, wx.ID_SAVE, _(u'&Save') + '\tCtrl+S', wx.ArtProvider.GetBitmap('PFS_PROJECT_SAVE_16'), wx.ArtProvider.GetBitmap('PFS_PROJECT_SAVE_D_16')) # CreateMenuItem(menu, wx.ID_SAVEAS, # _(u'Save Project &as'), # wx.ArtProvider.GetBitmap('PFS_PROJECT_SAVEAS_16')) menu.AppendSeparator() if editor: editor.AddMenuFileActions(menu) menu.AppendSeparator() CreateMenuItem(menu, ActionManager.ID_PROJECT_CLOSE, _(u'&Close') + '\tCtrl+W', wx.ArtProvider.GetBitmap('PFS_PROJECT_CLOSE_16'), wx.ArtProvider.GetBitmap('PFS_PROJECT_CLOSE_D_16')) menu.AppendSeparator() CreateMenuItem(menu, wx.ID_EXIT, _(u'E&xit') + '\tCtrl+Q', wx.ArtProvider.GetBitmap('PFS_EXIT_16')) return menu def __CreateMenuEdit(self, editor=None): menu = wx.Menu() if editor: editor.AddMenuEditActions(menu) return menu def __CreateMenuHelp(self): menu = wx.Menu() CreateMenuItem(menu, wx.ID_HELP, _(u'&Help') + '\tF1', wx.ArtProvider.GetBitmap('PFS_HELP_16')) menu.AppendSeparator() langMenu = wx.Menu() langMenu.AppendRadioItem(self.ID_LANG_EN, u"English") langMenu.AppendRadioItem(self.ID_LANG_FR, u"Français") langMenu.AppendRadioItem(self.ID_LANG_DE, u"Deutsch") langMenu.AppendRadioItem(self.ID_LANG_NL, u"Nederlands") langMenu.AppendRadioItem(self.ID_LANG_PT_BR, u"Português (Brasil)") langMenu.AppendRadioItem(self.ID_LANG_CS, u"Český") langMenu.AppendRadioItem(self.ID_LANG_IT, u"Italiano") langMenu.AppendRadioItem(self.ID_LANG_KO, u"한국어") langMenu.AppendRadioItem(self.ID_LANG_RU, u"русский") langMenu.AppendRadioItem(self.ID_LANG_TA, u"தமிழ்") langMenu.AppendRadioItem(self.ID_LANG_UK, u"Український") langMenu.AppendRadioItem(self.ID_LANG_EL, u"ελληνικά") menu.Append(wx.NewId(), _("Language"), langMenu) menu.AppendSeparator() CreateMenuItem(menu, wx.ID_ABOUT, _(u'&About'), wx.ArtProvider.GetBitmap('PFS_ABOUT_16')) return menu def OnDropDownNew(self, event): menu = self.__CreateMenuNew() self._frame.PopupMenu(menu) def UpdateActions(self, newEditor): while self._toolFix < self._toolBar.GetToolsCount(): self._toolBar.DeleteToolByPos(self._toolFix) if self._prevEditor: self._prevEditor.DisconnEvents(self._frame) menuFile = self.__CreateMenuFile(newEditor) menuEdit = self.__CreateMenuEdit(newEditor) self._menuBar.Replace(0, menuFile, _(u'&File')).Destroy() self._menuBar.Replace(1, menuEdit, _(u'&Edit')).Destroy() if newEditor: newEditor.AddToolBarActions(self._toolBar) newEditor.ConnectEvents(self._frame) self._prevEditor = newEditor self._toolBar.Realize()
class Service(BaseService): #---------------------------------------------------------------------------- # Constants #---------------------------------------------------------------------------- SHOW_WINDOW = wx.NewId() # keep this line for each subclass, need unique ID for each Service def __init__(self, serviceName, embeddedWindowLocation = wx.lib.pydocview.EMBEDDED_WINDOW_LEFT): self._serviceName = serviceName self._embeddedWindowLocation = embeddedWindowLocation self._view = None def GetEmbeddedWindowLocation(self): return self._embeddedWindowLocation def SetEmbeddedWindowLocation(self, embeddedWindowLocation): self._embeddedWindowLocation = embeddedWindowLocation def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None): viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View"))) menuItemPos = self.GetMenuItemPos(viewMenu, viewMenu.FindItem(_("&Status Bar"))) + 1 viewMenu.InsertCheckItem(menuItemPos, self.SHOW_WINDOW, self.GetMenuString(), self.GetMenuDescr()) wx.EVT_MENU(frame, self.SHOW_WINDOW, frame.ProcessEvent) wx.EVT_UPDATE_UI(frame, self.SHOW_WINDOW, frame.ProcessUpdateUIEvent) return True def GetServiceName(self): """ String used to save out Service View configuration information """ return self._serviceName def GetMenuString(self): """ Need to override this method to provide menu item for showing Service View """ return _(self.GetServiceName()) def GetMenuDescr(self): """ Need to override this method to provide menu item for showing Service View """ return _("Show or hides the %s window") % self.GetMenuString() #---------------------------------------------------------------------------- # Event Processing Methods #---------------------------------------------------------------------------- def ProcessEvent(self, event): id = event.GetId() if id == self.SHOW_WINDOW: self.ToggleWindow(event) return True else: return False def ProcessUpdateUIEvent(self, event): id = event.GetId() if id == self.SHOW_WINDOW: event.Check(self._view != None and self._view.IsShown()) event.Enable(True) return True else: return False #---------------------------------------------------------------------------- # View Methods #---------------------------------------------------------------------------- def _CreateView(self): """ This method needs to be overridden with corresponding ServiceView """ return ServiceView(self) def GetView(self): # Window Menu Service Method return self._view def SetView(self, view): self._view = view def ShowWindow(self, show = True): if show: if self._view: if not self._view.IsShown(): self._view.Show() else: view = self._CreateView() view.OnCreate(None, flags = 0) self.SetView(view) else: if self._view: if self._view.IsShown(): self._view.Hide() def HideWindow(self): self.ShowWindow(False) def ToggleWindow(self, event): show = event.IsChecked() wx.ConfigBase_Get().WriteInt(self.GetServiceName()+"Shown", show) self.ShowWindow(show) def OnCloseFrame(self, event): if not self._view: return True if wx.GetApp().IsMDI(): self._view.OnCloseWindow(event) # This is called when any SDI frame is closed, so need to check if message window is closing or some other window elif self._view == event.GetEventObject().GetView(): self.SetView(None) return True def GetIconIndex(self): return -1
def OnCreate(self, doc, flags): config = wx.ConfigBase_Get() windowLoc = self._service.GetEmbeddedWindowLocation() if windowLoc == FLOATING_MINIFRAME: pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt(self._service.GetServiceName() + "FrameYLoc", -1) # make sure frame is visible screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[1] >= screenHeight: pos = wx.DefaultPosition size = wx.Size(config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1)) title = _(self._service.GetServiceName()) if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName(): title = title + " - " + wx.GetApp().GetAppName() frame = wx.MiniFrame(wx.GetApp().GetTopWindow(), -1, title, pos = pos, size = size, style = wx.CLOSE_BOX|wx.CAPTION|wx.SYSTEM_MENU) wx.EVT_CLOSE(frame, self.OnCloseWindow) elif wx.GetApp().IsMDI(): self._embeddedWindow = wx.GetApp().GetTopWindow().GetEmbeddedWindow(windowLoc) frame = self._embeddedWindow else: pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt(self._service.GetServiceName() + "FrameYLoc", -1) # make sure frame is visible screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[1] >= screenHeight: pos = wx.DefaultPosition size = wx.Size(config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1)) title = _(self._service.GetServiceName()) if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName(): title = title + " - " + wx.GetApp().GetAppName() frame = wx.GetApp().CreateDocumentFrame(self, doc, flags, pos = pos, size = size) frame.SetTitle(title) if config.ReadInt(self._service.GetServiceName() + "FrameMaximized", False): frame.Maximize(True) wx.EVT_CLOSE(frame, self.OnCloseWindow) self.SetFrame(frame) sizer = wx.BoxSizer(wx.VERTICAL) windowLoc = self._service.GetEmbeddedWindowLocation() if self._embeddedWindow or windowLoc == FLOATING_MINIFRAME: if (self._service.GetEmbeddedWindowLocation() == wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM): if ServiceView.bottomTab == None: iconList = wx.ImageList(16, 16, 3) interpreter_icon_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "interpreter.ico") interpreter_icon = wx.Icon(interpreter_icon_path, wx.BITMAP_TYPE_ICO) ServiceView.InterpreterIconIndex = iconList.AddIcon(interpreter_icon) search_icon_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "search.ico") search_icon = wx.Icon(search_icon_path, wx.BITMAP_TYPE_ICO) ServiceView.SearchIconIndex = iconList.AddIcon(search_icon) debug_icon_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "debug.ico") debug_icon = wx.Icon(debug_icon_path, wx.BITMAP_TYPE_ICO) ServiceView.DebugRunIconIndex = iconList.AddIcon(debug_icon) ServiceView.bottomTab = wx.Notebook(frame, wx.NewId(), (0,0), (100,100), wx.LB_DEFAULT, "Bottom Tab") ServiceView.bottomTab.AssignImageList(iconList) wx.EVT_RIGHT_DOWN(ServiceView.bottomTab, self.OnNotebookRightClick) wx.EVT_MIDDLE_DOWN(ServiceView.bottomTab, self.OnNotebookMiddleClick) sizer.Add(ServiceView.bottomTab, 1, wx.TOP|wx.EXPAND, 4) def OnFrameResize(event): ServiceView.bottomTab.SetSize(ServiceView.bottomTab.GetParent().GetSize()) frame.Bind(wx.EVT_SIZE, OnFrameResize) # Factor this out. self._control = self._CreateControl(ServiceView.bottomTab, wx.NewId()) if self._control != None: ServiceView.bottomTab.AddPage(self._control, self._service.GetServiceName()) if self._service.GetIconIndex() != -1: index = ServiceView.bottomTab.GetPageCount() - 1 ServiceView.bottomTab.SetPageImage(index,self._service.GetIconIndex()) ServiceView.bottomTab.Layout() else: # Factor this out. self._control = self._CreateControl(frame, wx.NewId()) sizer.Add(self._control) else: # Factor this out. self._control = self._CreateControl(frame, wx.NewId()) sizer.Add(self._control, 1, wx.EXPAND, 0) frame.SetSizer(sizer) frame.Layout() self.Activate() return True
MODE_ODONTOLOGY = 3 #Color Table from Slice #NumberOfColors, SaturationRange, HueRange, ValueRange SLICE_COLOR_TABLE = { _("Default "): (None, (0, 0), (0, 0), (0, 1)), _("Hue"): (None, (1, 1), (0, 1), (1, 1)), _("Saturation"): (None, (0, 1), (0.6, 0.6), (1, 1)), _("Desert"): (256, (1, 1), (0, 0.1), (1, 1)), _("Rainbow"): (256, (1, 1), (0, 0.8), (1, 1)), _("Ocean"): (256, (1, 1), (0.667, 0.5), (1, 1)), _("Inverse Gray"): (256, (0, 0), (0, 0), (1, 0)), } # Volume view angle VOL_FRONT = wx.NewId() VOL_BACK = wx.NewId() VOL_RIGHT = wx.NewId() VOL_LEFT = wx.NewId() VOL_TOP = wx.NewId() VOL_BOTTOM = wx.NewId() VOL_ISO = wx.NewId() # Camera according to volume's orientation AXIAL_VOLUME_CAM_VIEW_UP = {VOL_FRONT:(0,0,1), VOL_BACK:(0,0,1), VOL_RIGHT:(0,0,1),\ VOL_LEFT:(0,0,1), VOL_TOP:(0,1,0), VOL_BOTTOM:(0,-1,0),\ VOL_ISO:(0,0,1)} AXIAL_VOLUME_CAM_POSITION = {VOL_FRONT:(0,-1,0), VOL_BACK:(0,1,0), VOL_RIGHT:(-1,0,0),\ VOL_LEFT:(1,0,0), VOL_TOP:(0,0,1), VOL_BOTTOM:(0,0,-1),\ VOL_ISO:(0.5,-1,0.5)}
return HelpBookItemDlg(parent, _('Help Book - Contents'), title, _('Title'), htmlTitle, location, _('Location'), anchors) [ wxID_HELPBOOKITEMDLG, wxID_HELPBOOKITEMDLGBTNREADTITLE, wxID_HELPBOOKITEMDLGBUTTON2, wxID_HELPBOOKITEMDLGBUTTON3, wxID_HELPBOOKITEMDLGCBBANCHORS, wxID_HELPBOOKITEMDLGSTATICTEXT1, wxID_HELPBOOKITEMDLGSTATICTEXT2, wxID_HELPBOOKITEMDLGTXTPAGE, wxID_HELPBOOKITEMDLGTXTTITLE, ] = [wx.NewId() for _init_ctrls in range(9)] class HelpBookItemDlg(wx.Dialog): def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_HELPBOOKITEMDLG, name='HelpBookItemDlg', parent=prnt, pos=wx.Point(452, 359), size=wx.Size(446, 136), style=wx.DEFAULT_DIALOG_STYLE, title=self.caption) self.SetClientSize(wx.Size(438, 109))
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name='window', picture=wx.NullBitmap, imageQuality=wx.IMAGE_QUALITY_HIGH, backgroundColor=None, backgroundTextureBmp=wx.NullBitmap): """ Constructs a window, which can be a child of a frame, dialog or any other non-control window. :param `parent`: (`wx.Window`) - Pointer to a parent window. :param `id`: (int) - Window identifier. If ID_ANY, will automatically create an identifier. :param `pos`: (`wx.Point`) - Window position. DefaultPosition indicates that wxWidgets should generate a default position for the window. If using the Window class directly, supply an actual position. :param `size`: (`wx.Size`) - Window size. DefaultSize indicates that wxWidgets should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized. :param `style`: (long) - Window style. For generic window styles, please see `wx.Window`. :param `name`: (string) - Window name. :param `imageQuality`: ImageResizeQuality of the Picture. Default is ``wx.IMAGE_QUALITY_HIGH`` :type `imageQuality`: One of the following: ``wx.IMAGE_QUALITY_NEAREST``, ``wx.IMAGE_QUALITY_BILINEAR``, ``wx.IMAGE_QUALITY_BICUBIC``, ``wx.IMAGE_QUALITY_BOX_AVERAGE``, ``wx.IMAGE_QUALITY_NORMAL``, ``wx.IMAGE_QUALITY_HIGH`` :param `backgroundColor`: Background color for the picture. :type `backgroundColor`: A `wx.Colour` or (int(r), int(g), int(b)) tuple """ wx.Window.__init__(self, parent, id, pos, size, style, name) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) if isinstance(picture, wx.Bitmap): self.origbitmap = picture self.bitmap = picture else: # Figure out if we can use what was sent in other ways. self.origbitmap = self._ConvertifyToPicture(picture) self.bitmap = self._ConvertifyToPicture(picture) if backgroundColor: if isinstance(backgroundColor, tuple): self.backgroundColor = wx.Colour(backgroundColor) elif isinstance(backgroundColor, wx.Colour): self.backgroundColor = wx.Brush(backgroundColor) else: raise TypeError(_(u'Unknown backgroundColor type')) self.backgroundColor = wx.Brush(self.GetBackgroundColour()) else: self.backgroundColor = wx.Brush(self.GetBackgroundColour()) self.useBackgroundTexture = True self.useBackgroundGradient = False self.backgroundTextureBmp = wx.NullBitmap self.backgroundGradientStops = (wx.BLACK, wx.WHITE) self.imageQualityMenuItems = ( (wx.NewId(), 'wx.IMAGE_QUALITY_NEAREST', _(u'Simplest and fastest algorithm.')), (wx.NewId(), 'wx.IMAGE_QUALITY_BILINEAR', _(u'Compromise between wx.IMAGE_QUALITY_NEAREST and wx.IMAGE_QUALITY_BICUBIC.')), (wx.NewId(), 'wx.IMAGE_QUALITY_BICUBIC', _(u'Highest quality but slowest execution time.')), (wx.NewId(), 'wx.IMAGE_QUALITY_BOX_AVERAGE', _(u'Use surrounding pixels to calculate an average that will be used for new pixels.')), (wx.NewId(), 'wx.IMAGE_QUALITY_NORMAL', _(u'Default image resizing algorithm used by wx.Image.Scale .')), (wx.NewId(), 'wx.IMAGE_QUALITY_HIGH', _(u'Best image resizing algorithm.'))) [self.Bind(wx.EVT_MENU, self.OnChangeImageQuality, id=newid) for newid, text, help in self.imageQualityMenuItems] self.imageQualityEnums = { 'wx.IMAGE_QUALITY_NEAREST': wx.IMAGE_QUALITY_NEAREST, 'wx.IMAGE_QUALITY_BILINEAR': wx.IMAGE_QUALITY_BILINEAR, 'wx.IMAGE_QUALITY_BICUBIC': wx.IMAGE_QUALITY_BICUBIC, 'wx.IMAGE_QUALITY_BOX_AVERAGE': wx.IMAGE_QUALITY_BOX_AVERAGE, 'wx.IMAGE_QUALITY_NORMAL': wx.IMAGE_QUALITY_NORMAL, 'wx.IMAGE_QUALITY_HIGH': wx.IMAGE_QUALITY_HIGH } self.imageQuality = imageQuality self.allowOverscaling = False self.allowDownscaling = True # Context Menu Item IDs self.ID_TOGGLEALLOWOVERSCALING = wx.NewId() self.ID_TOGGLEALLOWDOWNSCALING = wx.NewId() #--Events self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu) self.BindEvents() self.OnSize()
# You should have received a copy of the GNU General Public License # along with Glumol. If not, see <http://www.gnu.org/licenses/>. import wx import wx.lib.flatnotebook as fnb def create(parent): return OptionsWindow(parent) [ wxID_WXOPTIONSDIALOG, wxID_WXOPTIONSNOTEBOOK, wxID_WXDIALOG1BUTTON1, wxID_WXDIALOG1BUTTON2 ] = map(lambda _init_ctrls: wx.NewId(), range(4)) [wxID_WXPANEL1] = map(lambda _init_ctrls: wx.NewId(), range(1)) class OptionsWindow(wx.Dialog): def __init__(self, parent): self.parent = parent self.pages = [] wx.Dialog.__init__(self, id=wxID_WXOPTIONSDIALOG, name='', parent=parent, pos=wx.DefaultPosition, size=wx.Size(500, 400),
def __init__(self, prnt, cnt): self.win=wx.ScrolledWindow.__init__(self, parent=prnt, id=-1,size = wx.DefaultSize) self.SetScrollbars(1,1,100,100) ##### self.FitInside() ###### png = wx.Image((cfg.path_img + "cerca19x19.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() #wx.Frame.__init__(self, id=wx.NewId(), name='', # parent=prnt, pos=wx.Point(0, 0), # style=wx.DEFAULT_FRAME_STYLE , title=cnt[0]) #self.SetIcon(wx.Icon(cfg.path_img+"/null.ico", wx.BITMAP_TYPE_ICO)) #self.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False)) self.color=self.GetBackgroundColour() self.cnt = cnt Nid = wx.NewId() self.ttl=cnt[0] self.tipoord =cnt[1] self.tcpart="C" self.ottl="Stampa Schede" self.tbl="movcon" self.tblart="articoli" self.rec=cnt[2] self.AggMenu=cnt[3] self.IDMENU=cnt[4] #self.font=self.GetFont() #self.SetClientSize(wx.Size(680, 400)) self.__MDI__= wx.GetApp().GetPhasisMdi() self.font=self.__MDI__.font self.SetFont(self.font) self.CnAz=self.__MDI__.GetConnAZ() self.annoc=self.__MDI__.GetAnnoC() self.datacon= self.__MDI__.GetDataC() self.dzDatiAzienda= self.__MDI__.dzDatiAzienda self.pnl = wx.Panel(id=wx.NewId(), name='panel1', parent=self, pos=wx.Point(0, 0), size = wx.DLG_SZE(self,680/2,400/2), #size=wx.Size(680, 400), style = wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) self.pnl.SetFont(self.font) btnSzeL = wx.DLG_SZE(self.pnl, 70,16) btnSzeM = wx.DLG_SZE(self.pnl, 80,16) btnSzeM1 = wx.DLG_SZE(self.pnl, 60,16) btnSzeS = wx.DLG_SZE(self.pnl, 16,16) btnSzeD = wx.DLG_SZE(self.pnl, 60,14) #self.pnl.SetFont(self.font) wx.StaticText(self.pnl, -1, "Contropartita :", wx.DLG_PNT(self.pnl, 10,27)) self.CFM = wx.ComboBox(self.pnl, Nid,"", wx.DLG_PNT(self.pnl, 65,25), wx.DLG_SZE(self.pnl, 60,-1), [], wx.CB_DROPDOWN | wx.CB_SORT ) self.vCFM = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 275,20)) self.lcodcf = wx.StaticText(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 135,27)) self.codcf = wx.TextCtrl(self.pnl, Nid, "", wx.DLG_PNT(self.pnl, 185, 25), wx.DLG_SZE(self.pnl, 60,cfg.DIMFONTDEFAULT)) self.ccodcf = wx.BitmapButton(self.pnl, -1, png,#wx.Button(self.pnl, Nid, "...", wx.DLG_PNT(self.pnl, 250,25), wx.DLG_SZE(self.pnl,cfg.btnSzeSH,cfg.btnSzeV)) self.lragsoc1 = wx.StaticText(self.pnl, -1, "Rag. Sociale1 ( Cognome ) :", wx.DLG_PNT(self.pnl, 12,40)) self.ragsoc1 = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 10,50), wx.DLG_SZE(self.pnl, 120,cfg.DIMFONTDEFAULT),wx.TE_PROCESS_ENTER) self.cragsoc1 = wx.BitmapButton(self.pnl, -1, png,#wx.Button(self.pnl, -1, "...", wx.DLG_PNT(self.pnl, 135,50), wx.DLG_SZE(self.pnl,cfg.btnSzeSH,cfg.btnSzeV)) self.lragsoc2 = wx.StaticText(self.pnl, -1, "Rag. Sociale2 ( Nome ) :", wx.DLG_PNT(self.pnl, 155,40)) self.ragsoc2 = wx.TextCtrl(self.pnl, Nid, "", wx.DLG_PNT(self.pnl, 153, 50), wx.DLG_SZE(self.pnl, 110,cfg.DIMFONTDEFAULT)) self.MM = wx.ComboBox(self.pnl, -1,"", wx.DLG_PNT(self.pnl, 40,70), wx.DLG_SZE(self.pnl, 65,-1), [],wx.CB_DROPDOWN ) self.vMM = wx.TextCtrl(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 150,70)) self.lc1 = wx.ListCtrl(self.pnl , -1, wx.DLG_PNT(self.pnl, 10,75), wx.DLG_SZE(self.pnl , 300,80), wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES) wx.StaticText(self.pnl, -1, "", wx.DLG_PNT(self.pnl, 120,202)) wx.StaticText(self.pnl, -1, "Conto Avere:", wx.DLG_PNT(self.pnl, 10,182)) self.avere = wx.TextCtrl(self.pnl, Nid, "0,00", wx.DLG_PNT(self.pnl, 50,180), wx.DLG_SZE(self.pnl, 65, cfg.DIMFONTDEFAULT), wx.ALIGN_RIGHT ) wx.StaticText(self.pnl, -1, "Conto Dare:", wx.DLG_PNT(self.pnl, 120,182)) self.dare = wx.TextCtrl(self.pnl, Nid, "0,00", wx.DLG_PNT(self.pnl, 160,180), wx.DLG_SZE(self.pnl, 65, cfg.DIMFONTDEFAULT), wx.ALIGN_RIGHT ) wx.StaticText(self.pnl, -1, "Totale:", wx.DLG_PNT(self.pnl, 245,182)) self.totale = wx.TextCtrl(self.pnl, Nid, "0,00", wx.DLG_PNT(self.pnl, 270,180), wx.DLG_SZE(self.pnl, 65, cfg.DIMFONTDEFAULT), wx.ALIGN_RIGHT ) self.ok = wx.Button(self.pnl , -1, cfg.vcok, wx.DLG_PNT(self.pnl , 275,10), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.inte = wx.Button(self.pnl , -1, cfg.vcint, wx.DLG_PNT(self.pnl , 275,25), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.inte.SetFocus() self.canc = wx.Button(self.pnl , -1, cfg.vccanc, wx.DLG_PNT(self.pnl , 275,25), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) self.canc.SetFocus() self.stampa = wx.Button(self.pnl, -1, cfg.vcstampa, wx.DLG_PNT(self.pnl, 275,40), wx.DLG_SZE(self.pnl,cfg.btnSzeLH,cfg.btnSzeV)) for x in self.pnl.GetChildren(): x.SetFont(self.font) #self.SetFont(self.font) #box_sizer = wx.BoxSizer(wx.VERTICAL) #box_sizer.Add(self.pnl, 0, wx.EXPAND|wx.ALL,0) #self.SetAutoLayout(1) #self.SetSizer(box_sizer) #box_sizer.Fit(self) box = wx.GridSizer(1, 1) box.Add(self.pnl, 0, wx.ALIGN_CENTER|wx.ALL,10) self.SetSizer(box) box.Fit(self) self.canc.Bind(wx.EVT_BUTTON, self.Close) self.inte.Bind(wx.EVT_BUTTON, self.Start) self.ragsoc1.Bind(wx.EVT_TEXT_ENTER, self.FndAnag) self.Bind(wx.EVT_CLOSE, self.Close) #self.lc.Bind(wx.EVT_LEFT_DCLICK, self.DblClick) self.CFM.Bind(wx.EVT_TEXT_ENTER, self.KillFcs_CFM) self.CFM.Bind(wx.EVT_COMBOBOX, self.SelCFM) self.cragsoc1.Bind(wx.EVT_BUTTON, self.FndAnag) self.stampa.Bind(wx.EVT_BUTTON, self.Stampa) self.MM.Bind(wx.EVT_COMBOBOX, self.SelMM) self.Start(self)
import wx.lib.foldpanelbar as fpb import wx.lib.colourselect as csel import invesalius.constants as const import invesalius.data.slice_ as slice_ import invesalius.gui.dialogs as dlg import wx.lib.platebtn as pbtn import invesalius.project as prj import invesalius.utils as utl #INTERPOLATION_MODE_LIST = ["Cubic", "Linear", "NearestNeighbor"] MIN_TRANSPARENCY = 0 MAX_TRANSPARENCY = 100 ############# BTN_NEW = wx.NewId() MENU_SQUARE = wx.NewId() MENU_CIRCLE = wx.NewId() OP_LIST = [_("Draw"), _("Erase"), _("Threshold")] class TaskPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) inner_panel = InnerTaskPanel(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(inner_panel, 0, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | wx.LEFT, 7)
# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. import utils import wx [wxID_PANEL, wxID_PANELCLEARUNDO, wxID_PANELENCODINGGROUP, wxID_PANELENCODINGSELECT, wxID_PANELSHOWHIDDENDIRS, wxID_PANELSTATICBOX1, wxID_PANELSTATICTEXT1, wxID_PANELSTATICTEXT2, wxID_PANELUSEDIRTREE, ] = [wx.NewId() for __init_ctrls in range(9)] class Panel(wx.Panel): def __init_itemsizer_items(self, parent): parent.AddSpacer(wx.Size(8, 15), border=0, flag=0) parent.AddWindow(self.clearUndo, 0, border=15, flag=wx.LEFT) parent.AddSpacer(wx.Size(8, 15), border=0, flag=0) parent.AddWindow(self.useDirTree, 0, border=15, flag=wx.LEFT) parent.AddSpacer(wx.Size(5, 5), border=10, flag=0) parent.AddWindow(self.showHiddenDirs, 0, border=25, flag=wx.LEFT) parent.AddSpacer(wx.Size(-1, 20), border=0, flag=0) parent.AddSizer(self.encodingSizer, 0, border=15, flag=wx.LEFT) parent.AddSpacer(wx.Size(8, 35), border=0, flag=0) def _init_encodingsizer(self, parent):
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Timeline. If not, see <http://www.gnu.org/licenses/>. import wx from timelinelib.db.exceptions import TimelineIOError from timelinelib.db.objects.category import sort_categories # Border, in pixels, between controls in a window (should always be used when # border is needed) BORDER = 5 # Used by dialogs as a return code when a TimelineIOError has been raised ID_ERROR = wx.NewId() class WildcardHelper(object): def __init__(self, name, extensions): self.name = name self.ext_data = {} self.ext_names = [] self._extract_ext_info(extensions) def wildcard_string(self): return "%s (%s)|%s" % (self.name, ", ".join([ "*." + e for e in self.ext_names ]), ";".join(["*." + e for e in self.ext_names])) def get_path(self, dialog):
def __init__(self, parent, portfolio, operation, except_portfolio=None): iTradeSizedDialog.__init__(self, parent, -1, message('portfolio_%s_title' % operation), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, size=(420, 420)) # init if portfolio: self.m_name = portfolio.filename() self.m_accountref = portfolio.accountref() else: self.m_name = '' self.m_accountref = '' self.m_except = except_portfolio # container container = self.GetContentsPane() container.SetSizerType("vertical") # resizable pane pane = sc.SizedPanel(container, -1) pane.SetSizerType("form") pane.SetSizerProps(expand=True) # Row 1 label = wx.StaticText(pane, -1, message('portfolio_select_textfield')) label.SetSizerProps(valign='center') self.wxNameCtrl = wx.TextCtrl(pane, -1, self.m_name, size=(80, -1)) self.wxNameCtrl.SetSizerProps(expand=True) # Row 2 : tID = wx.NewId() self.m_imagelist = wx.ImageList(16, 16) self.sm_q = self.m_imagelist.Add( wx.Bitmap(os.path.join(itrade_config.dirRes, 'quote.png'))) self.sm_i = self.m_imagelist.Add( wx.Bitmap(os.path.join(itrade_config.dirRes, 'invalid.png'))) self.sm_up = self.m_imagelist.Add( wx.Bitmap(os.path.join(itrade_config.dirRes, 'sm_up.png'))) self.sm_dn = self.m_imagelist.Add( wx.Bitmap(os.path.join(itrade_config.dirRes, 'sm_down.png'))) self.m_list = iTradeSelectorListCtrl(container, tID, style=wx.LC_REPORT | wx.SUNKEN_BORDER, size=(400, 380)) self.m_list.SetImageList(self.m_imagelist, wx.IMAGE_LIST_SMALL) self.m_list.SetSizerProps(expand=True) self.PopulateList() # Now that the list exists we can init the other base class, # see wxPython/lib/mixins/listctrl.py wxl.ColumnSorterMixin.__init__(self, 3) wx.EVT_LIST_COL_CLICK(self, tID, self.OnColClick) wx.EVT_LIST_ITEM_ACTIVATED(self, tID, self.OnItemActivated) wx.EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected) # Last Row : OK and Cancel btnpane = sc.SizedPanel(container, -1) btnpane.SetSizerType("horizontal") btnpane.SetSizerProps(expand=True) if operation == 'delete': msg = message('portfolio_properties_btndelete') msgdesc = message('portfolio_properties_btndeletedesc') elif operation == 'select': msg = message('portfolio_properties_btnselect') msgdesc = message('portfolio_properties_btnselectdesc') else: msg = message('valid') msgdesc = message('valid_desc') # context help if wx.Platform != "__WXMSW__": btn = wx.ContextHelpButton(btnpane) # OK btn = wx.Button(btnpane, wx.ID_OK, msg) btn.SetDefault() btn.SetHelpText(msgdesc) wx.EVT_BUTTON(self, wx.ID_OK, self.OnValid) # CANCEL btn = wx.Button(btnpane, wx.ID_CANCEL, message('cancel')) btn.SetHelpText(message('cancel_desc')) # a little trick to make sure that you can't resize the dialog to # less screen space than the controls need self.Fit() self.SetMinSize(self.GetSize()) self.wxNameCtrl.SetFocus()
import platform # import Python's time module import time # import Transana's Dialogs import Dialogs # import Transana's Constants import TransanaConstants # import Transana's Global variables import TransanaGlobal # Import Transana Images import TransanaImages # import Transana's Printout Class import TranscriptPrintoutClass # Define button constants T_DATETIME = wx.NewId() T_SAVEAS = wx.NewId() T_PAGESETUP = wx.NewId() T_PRINTPREVIEW = wx.NewId() T_PRINT = wx.NewId() T_HELP = wx.NewId() T_EXIT = wx.NewId() CMD_SEARCH_BACK_ID = wx.NewId() CMD_SEARCH_NEXT_ID = wx.NewId() class NoteEditor(wx.Dialog): """ This class provides a simple editor for notes that are attached to various Transana objects. """ def __init__(self, parent, default_text=""): """Initialize an NoteEditor object.""" # Determine the screen size
def __init__(self, parent, ID, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): """ Initialize the class """ wx.Frame.__init__(self, parent, ID, title, pos, size, style) DBOpen() self.db = CachedDb() self.parent = parent self.MakeWindow() self.RegisterEventHandlers() self.GPSInit = False #Main Sizer mainSizer = wx.BoxSizer(wx.HORIZONTAL) #Right side of mainwindow self.mainNotebook = TrackNotebook(self, -1, self.db.GetFirstTrack()) #Left side of mainwindow leftSizer = wx.BoxSizer(wx.VERTICAL) ## the chooser notebook self.chooserNotebook = wx.Notebook(self, -1, size=(200, 100)) self.tp = TrackPanel(self.chooserNotebook, -1, self.mainNotebook) self.chooserNotebook.AddPage(self.tp, "Tracks") ## the action panel self.actionPanel = wx.GridSizer(3, 2) id = wx.NewId() importButton = wx.Button(self, id, "Import") wx.EVT_BUTTON(self, id, self.OnNotYetImplemented) id = wx.NewId() exportButton = wx.Button(self, id, "Export") wx.EVT_BUTTON(self, id, self.OnNotYetImplemented) id = wx.NewId() getButton = wx.Button(self, id, "Get From GPS") wx.EVT_BUTTON(self, id, self.OnGetButton) id = wx.NewId() sendButton = wx.Button(self, id, "Send To GPS") wx.EVT_BUTTON(self, id, self.OnNotYetImplemented) id = wx.NewId() removeButton = wx.Button(self, id, "Remove") wx.EVT_BUTTON(self, id, self.OnRemoveButton) id = wx.NewId() renameButton = wx.Button(self, id, "Rename") wx.EVT_BUTTON(self, id, self.OnRenameButton) self.actionPanel.Add(importButton, 1, wx.ALL | wx.EXPAND, 5) self.actionPanel.Add(exportButton, 1, wx.ALL | wx.EXPAND, 5) self.actionPanel.Add(getButton, 1, wx.ALL | wx.EXPAND, 5) self.actionPanel.Add(sendButton, 1, wx.ALL | wx.EXPAND, 5) self.actionPanel.Add(removeButton, 1, wx.ALL | wx.EXPAND, 5) self.actionPanel.Add(renameButton, 1, wx.ALL | wx.EXPAND, 5) leftSizer.Add(self.chooserNotebook, 1, wx.ALL | wx.EXPAND, 0) leftSizer.Add(self.actionPanel, 0, wx.ALL, 5) mainSizer.Add(leftSizer, 0, wx.ALL | wx.EXPAND, 5) mainSizer.Add(self.mainNotebook, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(mainSizer) self.SetAutoLayout(True) self.Layout() self.Fit() self.Center(wx.BOTH)
def __init__(self, parent, id): wx.Frame.__init__(self, parent,id,'Procesador de Imagen Raster Version 1.1.1.1', size=(1000,600)) p = wx.Panel(self) statuBar = self.CreateStatusBar() toolbar = self.CreateToolBar() abririmage=toolbar.AddSimpleTool(wx.NewId(),wx.Image('folder_picture.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo de Imagen","") toolbar.AddSimpleTool(1,wx.Image('folder_table.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo de Grilla","") toolbar.AddSimpleTool(2,wx.Image('folder_image.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo de Proyeccion","") toolbar.AddSimpleTool(3,wx.Image('folder_bell.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo de Perfil Temporal","") toolbar.AddSimpleTool(4,wx.Image('folder_page.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo de Perfil","") toolbar.AddSimpleTool(5,wx.Image('folder_go.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo de Arribos","") toolbar.AddSimpleTool(6,wx.Image('folder_feed.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Abrir Archivo SEGY","") toolbar.AddSeparator() toolbar.AddSimpleTool(7,wx.Image('guardar_image.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo de Imagen","") toolbar.AddSimpleTool(8,wx.Image('guardar_grid.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo de Grilla","") toolbar.AddSimpleTool(9,wx.Image('guardar_proyeccion.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo de Proyeccion","") toolbar.AddSimpleTool(10,wx.Image('guardar_temp_perfil.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo de Perfil Temporal","") toolbar.AddSimpleTool(11,wx.Image('guardar_perfil.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo de Perfil","") toolbar.AddSimpleTool(12,wx.Image('guardar_arribos.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo de Arribos","") toolbar.AddSimpleTool(13,wx.Image('guardar_segy.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Guardar Archivo SEGY","") toolbar.AddSeparator() toolbar.AddSimpleTool(14,wx.Image('calcular_image.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular Imagen","") toolbar.AddSimpleTool(15,wx.Image('calcular_grid.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular Grilla","") toolbar.AddSimpleTool(16,wx.Image('calcular_proyeccion.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular Proyeccion","") toolbar.AddSimpleTool(17,wx.Image('calcular_perfil_t.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular Perfil Temporal","") toolbar.AddSimpleTool(18,wx.Image('calcular_perfil.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular Perfil","") toolbar.AddSimpleTool(19,wx.Image('calcular_arribos.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular Arribos","") toolbar.AddSimpleTool(20,wx.Image('calcular_segy.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Calcular SEGY","") toolbar.AddSeparator() toolbar.AddSimpleTool(21,wx.Image('zoom.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Zoom","") toolbar.AddSimpleTool(22,wx.Image('hand.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Pan","") toolbar.AddSimpleTool(23,wx.Image('datacursor.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Data Cursor","") toolbar.AddSimpleTool(24,wx.Image('graficargrilla.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Graficar el Grupo de Grilla","") toolbar.AddSimpleTool(25,wx.Image('calcular_perfil.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Uso de la data calculada","") toolbar.AddSimpleTool(26,wx.Image('borrargrill.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Borrar Grilla","") toolbar.AddSimpleTool(27,wx.Image('image.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Imagen","") toolbar.AddSimpleTool(27,wx.Image('calcular_segy.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "Actualizar Grupo de Grilla","") toolbar.Realize() #self.Bind(wx.EVT_TOOL, self.OnNew, id=1) #self.figure = Figure() #self.axes = self.figure.add_subplot(111) #self.figure = Figure() #self.axes = self.figure.add_subplot(111) #self.canvas = FigureCanvas(self, wx.ID_ANY, self.figure) menuBar = wx.MenuBar() menu = wx.Menu() menuBar.Append(menu, "&Archivo") abririmage = menu.Append(-1,"Abrir Archivo de &Imagen\tCtrl-I") guardarimagen = menu.Append(-1,"Guardar Imagen\tCtrl-S") submenuproyt = wx.Menu() abrirproyect = submenuproyt.Append(-1,"Abrir de Proyeccion\tCtrl-P") guardarproyect = submenuproyt.Append(-1,"Guardar datos de Proyeccion\tCtrl-G") menu.AppendMenu(-1, "Datos de Proyeccion",submenuproyt) submenuperfil = wx.Menu() abrirperfil = submenuperfil.Append(-1,"Abrir de Perfil\tCtrl-shift-P") guardarperfil = submenuperfil.Append(-1,"Guardar datos de Perfil\tCtrl-shift-G") menu.AppendMenu(-1,"Datos de Perfil",submenuperfil) submenutperfil = wx.Menu() abrirtperfil = submenutperfil.Append(-1,"Abrir Archivo de Perfil Temporal\tCtrl-shift-T") guardartperfil = submenutperfil.Append(-1,"Guardar datos de Perfil Temporal\tCtrl-shift-H") menu.AppendMenu(-1,"Datos de Perfil Temporal",submenutperfil) submenuarribo = wx.Menu() abrirarribo = submenuarribo.Append(-1,"Abrir Archivo de Arribos\tCtrl-shift-A") guardararribo = submenuarribo.Append(-1,"Guardar datos de Arribos\tCtrl-shift-B") menu.AppendMenu(-1,"Datos de Arribos",submenuarribo) directoriotrabaj = menu.Append(-1,"Seleccione el &Directorio de Trabajo\tCtrl-D") menu.AppendSeparator() exit = menu.Append(-1,"Cerrar\tCtrl-W") self.Bind(wx.EVT_MENU, self.OnAbrirImage, abririmage) self.Bind(wx.EVT_MENU, self.OnAbrirProyect, abrirproyect) self.Bind(wx.EVT_MENU, self.OnAbrirPerfil, abrirperfil) self.Bind(wx.EVT_MENU, self.OnAbrirTPerfil, abrirtperfil) self.Bind(wx.EVT_MENU, self.OnAbrirArribo, abrirarribo) self.Bind(wx.EVT_MENU, self.OnGuardarImagen, guardarimagen) self.Bind(wx.EVT_MENU, self.OnGuardarProyect, guardarproyect) self.Bind(wx.EVT_MENU, self.OnGuardarPerfil, guardarperfil) self.Bind(wx.EVT_MENU, self.OnGuardarTPerfil, guardartperfil) self.Bind(wx.EVT_MENU, self.OnGuardarArribo, guardararribo) self.Bind(wx.EVT_MENU, self.OnExit, exit) #Elaboracion de menu Imagen menuimagen = wx.Menu() menuBar.Append(menuimagen, "&Imagen") #Submenu de Imagen extraerimage = menuimagen.Append(-1,"&Extraer region de la Imagen\tCtrl-E") imagenimagen = menuimagen.Append(-1,"Imagen\tCtrl-M") zoomimagen = menuimagen.Append(-1,"&Zoom\tCtrl-Z") panimage = menuimagen.Append(-1,"&Pan\tCtrl-P") datacurseimage = menuimagen.Append(-1,"&Data Cursor\tCtrl-D") #Elaboracion de menu Grid menugrid = wx.Menu() menuBar.Append(menugrid, "&Grid") #Submenu de Grid submenugridfile = wx.Menu() abrirgridfile = submenugridfile.Append(-1,"Abrir Grilla\tCtrl-L") guardargridfile = submenugridfile.Append(-1,"Guardar datos de la Grilla\tCtrl-U") menugrid.AppendMenu(-1, "Datos de la Grilla",submenugridfile) submenugridinsert = wx.Menu() verticalgridinsert = submenugridinsert.Append(-1,"Insertar Grilla Vertical\tCtrl-shift-V") horizontalgridinsert = submenugridinsert.Append(-1,"Insertar Grilla Horizontal\tCtrl-shift-H") menugrid.AppendMenu(-1, "Insertar Grilla",submenugridinsert) gridborrar = menugrid.Append(-1,"&Borrar Grilla\tCtrl-B") gridproyect = menugrid.Append(-1,"&Proyectar Variables\tCtrl-P") gridcalcular = menugrid.Append(-1,"&Calcular Grilla\tCtrl-G") gridactualdata = menugrid.Append(-1,"&Actualizar datos\tCtrl-shift-A") gridzonificacion = menugrid.Append(-1,"&Zonificacion\tCtrl-shift-Z") #Elaboracion de menu Registro menuregistro = wx.Menu() menuBar.Append(menuregistro, "&Registro") registrotraductor = menuregistro.Append(-1,"&Traducdor Normal\tCtrl-N") registrofabricar1 = menuregistro.Append(-1,"&Fabricar Registro Preliminar\tCtrl-F") registrofabricar2 = menuregistro.Append(-1,"&Fabricar Registro Definitivo\tCtrl-R") registrosavesegy = menuregistro.Append(-1,"G&uardar SEGY\tCtrl-Y") registroreadysegy = menuregistro.Append(-1,"&Leer SEGY\tCtrl-shift-L") registrorgraficarsegy = menuregistro.Append(-1,"&Graficar SEGY\tCtrl-shift-Y") registrormarcarllegadas = menuregistro.Append(-1,"&Marcar Llegadas\tCtrl-shift-M") self.SetMenuBar(menuBar) #ListBox dirlist = ['o','u','y'] listBox = wx.ListBox(p,-1,(20,20),(80,120),dirlist, wx.LB_SINGLE) listBox.SetSelection(3)
def __init__(self, parent, id): wx.Frame.__init__( self, parent, id, 'FMPUNO (Flash Memory Programmer UNO) - By Warber0x (Radouane SAMIR)', size=(900, 400), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX ^ wx.MINIMIZE_BOX) panel = wx.Panel(self, pos=(0, 100), size=(700, 200)) self.percent = 0 img = wx.Image('./avr.png') img.Rescale(170, 170) png = wx.Bitmap(img) wx.StaticBitmap(panel, -1, png, (713, 130), (png.GetWidth(), png.GetHeight())) #Menu Gui status = self.CreateStatusBar() menubar = wx.MenuBar() filemenu = wx.Menu() editmenu = wx.Menu() aboutmenu = wx.Menu() exititem = filemenu.Append(wx.NewId(), "&Exit", "") aboutitem = aboutmenu.Append(wx.NewId(), "&About", " Information about this program") edititem1 = editmenu.Append(wx.NewId(), "&Read", "") edititem2 = editmenu.Append(wx.NewId(), "&Erase", "") edititem3 = editmenu.Append(wx.NewId(), "&Program", "") menubar.Append(filemenu, "&File") menubar.Append(editmenu, "Edit") menubar.Append(aboutmenu, "?") self.SetMenuBar(menubar) self.Bind(wx.EVT_MENU, self.OnAbout, aboutitem) self.Bind(wx.EVT_MENU, self.OnExit, exititem) self.Bind(wx.EVT_MENU, self.OnRead, edititem1) self.Bind(wx.EVT_MENU, self.OnErase, edititem2) self.Bind(wx.EVT_MENU, self.OnProgram, edititem3) #End menubar #imageFile = "write.png" #imageFile2 = "read.png" #imageFile3 = "erase.png" #imageFile4 = "info.png" #imageWrite = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() #imageRead = wx.Image(imageFile2, wx.BITMAP_TYPE_ANY).ConvertToBitmap() #imageErase = wx.Image(imageFile3, wx.BITMAP_TYPE_ANY).ConvertToBitmap() #imageInfo = wx.Image(imageFile4, wx.BITMAP_TYPE_ANY).ConvertToBitmap() font3 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD) label6 = wx.StaticText(panel, -1, "Memory Operations", (30, 180)) label6.SetFont(font3) self.buttonProgram = wx.Button(panel, id=-1, label="Upload", pos=(50, 220), size=(65, 40)) self.buttonRead = wx.Button(panel, id=-1, label="Read", pos=(50 + 65, 220), size=(65, 40)) self.buttonErase = wx.Button(panel, id=-1, label="Erase", pos=(50, 260), size=(65, 40)) self.buttonInfo = wx.Button(panel, id=-1, label="Info", pos=(50 + 65, 260), size=(65, 40)) self.textarea = wx.TextCtrl(panel, pos=(240, 10), style=wx.TE_MULTILINE | wx.TE_READONLY, size=(450, 265)) font1 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD) label1 = wx.StaticText(panel, -1, "Programmer Setup", (30, 10)) label1.SetFont(font1) label2 = wx.StaticText(panel, -1, "Flash Ref.: ", (10, 47)) chip = ['AM29F010', 'AM29F040'] self.flashref = wx.TextCtrl(panel, -1, pos=(85, 40), size=(100, -1), style=wx.TE_READONLY) label3 = wx.StaticText(panel, -1, "Baude Rate: ", (10, 78)) baude = [ '115200', '57600', '38400', '28800', '19200', '14400', '9600', '4800' ] self.baudBox = wx.ComboBox(panel, -1, pos=(85, 73), size=(100, -1), choices=baude, style=wx.CB_READONLY) label4 = wx.StaticText(panel, -1, "Game File: ", (10, 110)) self.uploadText = wx.TextCtrl(panel, -1, pos=(85, 105), size=(100, -1), style=wx.TE_READONLY) buttonDlg = wx.Button(panel, id=-1, label='...', pos=(185, 105), size=(40, 25)) label5 = wx.StaticText(panel, -1, "Serial port: ", (10, 140)) arduinoSerial = ['ttyACM0', 'ttyACM1', 'ttyACM2', 'ttyACM3', 'ttyACM4'] self.serialBox = wx.ComboBox(panel, -1, pos=(85, 135), size=(100, -1), choices=arduinoSerial, style=wx.CB_READONLY) self.ln = wx.StaticLine(panel, -1, pos=(20, 170), size=(200, -1), style=wx.LI_HORIZONTAL) gaugeText = wx.StaticText(panel, -1, "Transfer status: ", (240, 283)) self.gauge = wx.Gauge(panel, -1, 100, pos=(240, 300), size=(450, 25)) font6 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD) label6 = wx.StaticText(panel, -1, "Memory infos", (730, 10)) label6.SetFont(font6) label7 = wx.StaticText(panel, -1, "Man ID: ", (710, 45)) self.manid = wx.TextCtrl(panel, -1, pos=(770, 40), size=(120, -1), style=wx.TE_READONLY) label8 = wx.StaticText(panel, -1, "Dev ID: ", (710, 70)) self.devid = wx.TextCtrl(panel, -1, pos=(770, 70), size=(120, -1), style=wx.TE_READONLY) self.ln = wx.StaticLine(panel, -1, pos=(700, 110), size=(200, -1), style=wx.LI_HORIZONTAL) self.Bind(wx.EVT_BUTTON, self.OnProgram, self.buttonProgram) self.Bind(wx.EVT_BUTTON, self.OnDlg, buttonDlg) self.Bind(wx.EVT_BUTTON, self.OnRead, self.buttonRead) self.Bind(wx.EVT_BUTTON, self.OnErase, self.buttonErase) self.Bind(wx.EVT_BUTTON, self.OnInfos, self.buttonInfo) self.Bind(wx.EVT_CLOSE, self.OnExit) self.intro = 'ARDUINO AMD FLASH MEMORY PROGRAMMER - XXX29F0XX Series\nVersion: 1.0\nArduino ver: UNO\nAuthor: Radouane SAMIR - Sam\nCreation 2013\n\nPlease connect your programmer, select the serial port, choose the baud rate and press one of the operations\n\nThe programmed baudrate in this version is 115200\n\n' self.intro = self.intro.upper() self.textarea.SetValue(self.intro) self.count = 0
# # Copyright (C) 2018 Jens Goepfert # import wx from photofilmstrip.gui.PnlPfsProject import ( PnlPfsProject, ID_PIC_IMPORT, ID_MUSIC, ID_RENDER_FILMSTRIP) from photofilmstrip.gui.DlgDuration import DlgDuration from photofilmstrip.gui.DlgPicDurationByAudio import DlgPicDurationByAudio from photofilmstrip.gui.helper import CreateMenuItem from photofilmstrip.gui.ImageSectionEditor import ImageProxy [ID_PROJECT_PROPS, ID_PIC_DURATION_BY_AUDIO, ] = [wx.NewId() for __ in range(2)] class PnlSlideshow(PnlPfsProject): def _GetEditorName(self): return _(u"Slideshow") def AddMenuFileActions(self, menu): PnlPfsProject.AddMenuFileActions(self, menu) CreateMenuItem(menu, ID_PROJECT_PROPS, _(u"&Properties"), wx.ArtProvider.GetBitmap('PFS_PROPERTIES_16')) return True def AddToolBarActions(self, toolBar):
#-----------------------------------------------------------------------------# # Imports import os import sys import wx import wx.aui as aui import IconFile # Put local package on the path sys.path.insert(0, os.path.abspath('../../src')) import eclib #-----------------------------------------------------------------------------# ID_NAVI = wx.NewId() #-----------------------------------------------------------------------------# class TestPanel(wx.Panel): def __init__(self, parent, log): wx.Panel.__init__(self, parent, wx.ID_ANY, size=(500, 500)) # Attributes self._paneNavi = None self.mgr = aui.AuiManager( self, aui.AUI_MGR_ALLOW_ACTIVE_PANE | aui.AUI_MGR_TRANSPARENT_HINT) self.log = log # Setup
def __init__(self, parent=None, ID=wx.ID_ANY, title="", diagram=None, name=""): """ Constructor. @parent : window parent of the frame @ID : ID of the frame @title : title of the frame @diagram : diagram included in the canvas embedded in the frame @name : name of the frame """ ### inherit call wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition, wx.Size(600, 400), name=name, style=wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN) ### local Copy self.title = title self.parent = parent self.diagram = diagram ### current abstract level #======================================================================= if hasattr(diagram, 'layers') and hasattr(diagram, 'current_level'): level = diagram.layers[0].current_level self.diagram = diagram.layers[level] else: level = 0 self.diagram = diagram #======================================================================= ### Canvas Stuff ----------------------------------- self.canvas = Container.ShapeCanvas(self, wx.ID_ANY, name=title, diagram=self.diagram) self.canvas.scalex = 1.0 self.canvas.scaley = 1.0 self.transparent = wx.ALPHA_OPAQUE ### ------------------------Diagram parent manager try: self.canvas.stockUndo = self.diagram.parent.stockUndo self.canvas.stockRedo = self.diagram.parent.stockRedo except Exception: diagram.SetParent(self.canvas) self.canvas.stockUndo = [] self.canvas.stockRedo = [] ### Menu ToolBar toolbar = wx.ToolBar(self, wx.ID_ANY, name='tb', style=wx.TB_HORIZONTAL | wx.NO_BORDER) toolbar.SetToolBitmapSize((25, 25)) # just for windows self.SetToolBar(toolbar) if self.parent: self.toggle_list = wx.GetApp().GetTopWindow().toggle_list else: sys.stdout.write( _('Alone mode for DetachedFrame: Connector buttons are not binded\n' )) self.toggle_list = [ wx.NewId(), wx.NewId(), wx.NewId(), wx.NewId(), wx.NewId(), wx.NewId() ] if wx.VERSION_STRING < '2.9': self.tools = [ toolbar.AddTool(Menu.ID_SAVE, wx.Bitmap(os.path.join(ICON_PATH, 'save.png')), shortHelpString=_('Save File'), longHelpString=_('Save the current diagram'), clientData=self.canvas), toolbar.AddTool( Menu.ID_SAVEAS, wx.Bitmap(os.path.join(ICON_PATH, 'save_as.png')), shortHelpString=_('Save File As'), longHelpString=_('Save the diagram with an another name'), clientData=self.canvas), toolbar.AddTool( wx.ID_UNDO, wx.Bitmap(os.path.join(ICON_PATH, 'undo.png')), shortHelpString=_('Undo'), longHelpString=_('Click to go back, hold to see history'), clientData=self.canvas), toolbar.AddTool( wx.ID_REDO, wx.Bitmap(os.path.join(ICON_PATH, 'redo.png')), shortHelpString=_('Redo'), longHelpString=_( 'Click to go forward, hold to see history'), clientData=self.canvas), toolbar.AddTool(Menu.ID_ZOOMIN_DIAGRAM, wx.Bitmap(os.path.join(ICON_PATH, 'zoom+.png')), shortHelpString=_('Zoom +'), longHelpString=_('Zoom in'), clientData=self.canvas), toolbar.AddTool(Menu.ID_ZOOMOUT_DIAGRAM, wx.Bitmap(os.path.join(ICON_PATH, 'zoom-.png')), shortHelpString=_('Zoom -'), longHelpString=_('Zoom out'), clientData=self.canvas), toolbar.AddTool(Menu.ID_UNZOOM_DIAGRAM, wx.Bitmap( os.path.join(ICON_PATH, 'no_zoom.png')), shortHelpString=_('AnnuleZoom'), longHelpString=_('Initial view'), clientData=self.canvas), toolbar.AddTool( Menu.ID_PRIORITY_DIAGRAM, wx.Bitmap(os.path.join(ICON_PATH, 'priority.png')), shortHelpString=_('Priority'), longHelpString=_('Activation models priority')), toolbar.AddTool(Menu.ID_CHECK_DIAGRAM, wx.Bitmap( os.path.join(ICON_PATH, 'check_master.png')), shortHelpString=_('Check'), longHelpString=_('Check all models')), toolbar.AddTool(Menu.ID_SIM_DIAGRAM, wx.Bitmap( os.path.join(ICON_PATH, 'simulation.png')), shortHelpString=_('Simulation'), longHelpString=_('Simulate the diagram')), toolbar.AddTool(self.toggle_list[0], wx.Bitmap( os.path.join(ICON_PATH, 'direct_connector.png')), shortHelpString=_('Direct'), longHelpString=_('Direct connector'), isToggle=True), toolbar.AddTool(self.toggle_list[1], wx.Bitmap( os.path.join(ICON_PATH, 'square_connector.png')), shortHelpString=_('Square'), longHelpString=_('Square connector'), isToggle=True), toolbar.AddTool(self.toggle_list[2], wx.Bitmap( os.path.join(ICON_PATH, 'linear_connector.png')), shortHelpString=_('Linear'), longHelpString=_('Linear connector'), isToggle=True) ] else: self.tools = [ toolbar.AddTool(Menu.ID_SAVE, "", wx.Bitmap(os.path.join(ICON_PATH, 'save.png')), wx.NullBitmap, shortHelp=_('Save File'), longHelp=_('Save the current diagram'), clientData=self.canvas), toolbar.AddTool( Menu.ID_SAVEAS, "", wx.Bitmap(os.path.join(ICON_PATH, 'save_as.png')), wx.NullBitmap, shortHelp=_('Save File As'), longHelp=_('Save the diagram with an another name'), clientData=self.canvas), toolbar.AddTool( wx.ID_UNDO, "", wx.Bitmap(os.path.join(ICON_PATH, 'undo.png')), wx.NullBitmap, shortHelp=_('Undo'), longHelp=_('Click to go back, hold to see history'), clientData=self.canvas), toolbar.AddTool( wx.ID_REDO, "", wx.Bitmap(os.path.join(ICON_PATH, 'redo.png')), wx.NullBitmap, shortHelp=_('Redo'), longHelp=_('Click to go forward, hold to see history'), clientData=self.canvas), toolbar.AddTool(Menu.ID_ZOOMIN_DIAGRAM, "", wx.Bitmap(os.path.join(ICON_PATH, 'zoom+.png')), wx.NullBitmap, shortHelp=_('Zoom +'), longHelp=_('Zoom in'), clientData=self.canvas), toolbar.AddTool(Menu.ID_ZOOMOUT_DIAGRAM, "", wx.Bitmap(os.path.join(ICON_PATH, 'zoom-.png')), wx.NullBitmap, shortHelp=_('Zoom -'), longHelp=_('Zoom out'), clientData=self.canvas), toolbar.AddTool(Menu.ID_UNZOOM_DIAGRAM, "", wx.Bitmap( os.path.join(ICON_PATH, 'no_zoom.png')), wx.NullBitmap, shortHelp=_('AnnuleZoom'), longHelp=_('Initial view'), clientData=self.canvas), toolbar.AddTool(Menu.ID_PRIORITY_DIAGRAM, "", wx.Bitmap( os.path.join(ICON_PATH, 'priority.png')), shortHelp=_('Priority')), toolbar.AddTool(Menu.ID_CHECK_DIAGRAM, "", wx.Bitmap( os.path.join(ICON_PATH, 'check_master.png')), shortHelp=_('Check')), toolbar.AddTool(Menu.ID_SIM_DIAGRAM, "", wx.Bitmap( os.path.join(ICON_PATH, 'simulation.png')), shortHelp=_('Simulation')), toolbar.AddTool(self.toggle_list[0], "", wx.Bitmap( os.path.join(ICON_PATH, 'direct_connector.png')), shortHelp=_('Direct'), kind=wx.ITEM_CHECK), toolbar.AddTool(self.toggle_list[1], "", wx.Bitmap( os.path.join(ICON_PATH, 'square_connector.png')), shortHelp=_('Square'), kind=wx.ITEM_CHECK), toolbar.AddTool(self.toggle_list[2], "", wx.Bitmap( os.path.join(ICON_PATH, 'linear_connector.png')), shortHelp=_('Linear'), kind=wx.ITEM_CHECK) ] toolbar.EnableTool(wx.ID_UNDO, not self.canvas.stockUndo == []) toolbar.EnableTool(wx.ID_REDO, not self.canvas.stockRedo == []) toolbar.InsertSeparator(2) toolbar.InsertSeparator(5) toolbar.InsertSeparator(9) toolbar.InsertSeparator(13) toolbar.InsertSeparator(17) toolbar.ToggleTool(self.toggle_list[0], 1) #======================================================================= ### spin control for abstraction hierarchy if isinstance(diagram, Container.Diagram): level_label = wx.StaticText(toolbar, -1, _("Level ")) self.spin = wx.SpinCtrl(toolbar, self.toggle_list[3], str(level), (55, 90), (50, -1), min=0, max=10) toolbar.AddControl(level_label) toolbar.AddControl(self.spin) ID_UPWARD = self.toggle_list[4] ID_DOWNWARD = self.toggle_list[5] if wx.VERSION_STRING < '2.9': self.tools.append( toolbar.AddTool(ID_DOWNWARD, wx.Bitmap( os.path.join(ICON_PATH, 'downward.png')), shortHelpString=_('Downward rules'), longHelpString=_( 'Define Downward rules atomic model'))) self.tools.append( toolbar.AddTool( ID_UPWARD, wx.Bitmap(os.path.join(ICON_PATH, 'upward.png')), shortHelpString=_('Upward rules'), longHelpString=_('Define Upward rules atomic model'))) else: self.tools.append( toolbar.AddTool(ID_DOWNWARD, "", wx.Bitmap( os.path.join(ICON_PATH, 'downward.png')), shortHelp=_('Downward rules'))) self.tools.append( toolbar.AddTool(ID_UPWARD, "", wx.Bitmap( os.path.join(ICON_PATH, 'upward.png')), shortHelp=_('Upward rules'))) ### update downward and upward button toolbar.EnableTool(ID_DOWNWARD, level != 0) toolbar.EnableTool(ID_UPWARD, level != 0) #======================================================================= toolbar.Realize() ### if Detached frame from block (container or Code) ### save, save-as and simulation are disabled if not isinstance(self.parent, Container.ShapeCanvas): #toolbar.EnableTool(Menu.ID_SAVE, False) #toolbar.EnableTool(Menu.ID_SAVEAS, False) toolbar.EnableTool(Menu.ID_SIM_DIAGRAM, False) toolbar.EnableTool( Menu.ID_PRIORITY_DIAGRAM, not 'PyPDEVS' in __builtin__.__dict__['DEFAULT_DEVS_DIRNAME']) else: toolbar.EnableTool(Menu.ID_SAVEAS, False) ### Call Printable constructor PrintOut.Printable.__init__(self, self.canvas) ### vertical box vbox = wx.BoxSizer(wx.VERTICAL) #vbox.Add(toolbar, 0, wx.EXPAND, border = 5) vbox.Add(self.canvas, 1, wx.EXPAND, border=5) self.SetSizer(vbox) self.CenterOnParent() self.statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP) self.statusbar.SetFieldsCount(3) self.statusbar.SetStatusWidths([-5, -2, -1]) self.__binding()
def new_id(): return wx.NewId()
# XXX Add 'Center in window' option def create(parent): return ControlAlignmentFrame(parent) [ wxID_CONTROLALIGNMENTFRAME, wxID_CONTROLALIGNMENTFRAMECANCELBTN, wxID_CONTROLALIGNMENTFRAMEOKBTN, wxID_CONTROLALIGNMENTFRAMEPANEL1, wxID_CONTROLALIGNMENTFRAMERADIOBOX1, wxID_CONTROLALIGNMENTFRAMERADIOBOX2, ] = [wx.NewId() for _init_ctrls in range(6)] class ControlAlignmentFrame(wx.Dialog): def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_CONTROLALIGNMENTFRAME, name='ControlAlignmentFrame', parent=prnt, pos=wx.Point(341, 140), size=wx.Size(328, 219), style=wx.DEFAULT_DIALOG_STYLE, title='Alignment') self.SetClientSize(wx.Size(320, 192))
import wx import invesalius.constants as const from wx.lib.pubsub import pub as Publisher import invesalius.session as ses from invesalius.gui.language_dialog import ComboBoxLanguage ID = wx.NewId() try: from agw import flatnotebook as fnb AGW = 1 except ImportError: # if it's not there locally, try the wxPython lib. import wx.lib.agw.flatnotebook as fnb AGW = 0 class Preferences(wx.Dialog): def __init__( self, parent, id = ID, title = _("Preferences"), size=wx.DefaultSize,\ pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE): try: pre = wx.PreDialog() pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) pre.Create(parent, ID, title, pos, size, style) self.PostCreate(pre) except AttributeError: wx.Dialog.__init__(self, parent, ID, title, pos, size, style) self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) sizer = wx.BoxSizer(wx.VERTICAL)