Exemplo n.º 1
0
def GetContinueIcon():
    return wx.IconFromBitmap(GetContinueBitmap())
Exemplo n.º 2
0
 def get_icon():
    return wx.IconFromBitmap(gamera_icons.getIconImageGreyBitmap())
Exemplo n.º 3
0
 def get_icon():
    return wx.IconFromBitmap(gamera_icons.getIconSubimageFloatBitmap())
Exemplo n.º 4
0
    def __init__(self, title):
        self.title = title
        wx.Frame.__init__(self, None, wx.ID_ANY, self.title)

        MainFrame.__instance = self

        #Load stored settings (width/height/maximized..)
        self.LoadMainFrameAttribs()

        #Fix for msw (have the frame background color match panel color
        if 'wxMSW' in wx.PlatformInfo:
            self.SetBackgroundColour(
                wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))

        #Load and set the icon for pyfa main window
        i = wx.IconFromBitmap(BitmapLoader.getBitmap("pyfa", "gui"))
        self.SetIcon(i)

        #Create the layout and windows
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.browser_fitting_split = wx.SplitterWindow(self,
                                                       style=wx.SP_LIVE_UPDATE)
        self.fitting_additions_split = wx.SplitterWindow(
            self.browser_fitting_split, style=wx.SP_LIVE_UPDATE)

        mainSizer.Add(self.browser_fitting_split, 1, wx.EXPAND | wx.LEFT, 2)

        self.fitMultiSwitch = MultiSwitch(self.fitting_additions_split)
        self.additionsPane = AdditionsPane(self.fitting_additions_split)

        self.notebookBrowsers = gui.chromeTabs.PFNotebook(
            self.browser_fitting_split, False)

        marketImg = BitmapLoader.getImage("market_small", "gui")
        shipBrowserImg = BitmapLoader.getImage("ship_small", "gui")

        self.marketBrowser = MarketBrowser(self.notebookBrowsers)
        self.notebookBrowsers.AddPage(self.marketBrowser,
                                      _("mainFrame_Market"),
                                      tabImage=marketImg,
                                      showClose=False)
        self.marketBrowser.splitter.SetSashPosition(self.marketHeight)

        self.shipBrowser = ShipBrowser(self.notebookBrowsers)
        self.notebookBrowsers.AddPage(self.shipBrowser,
                                      _("mainFrame_Ships"),
                                      tabImage=shipBrowserImg,
                                      showClose=False)

        #=======================================================================
        # DISABLED FOR RC2 RELEASE
        #self.fleetBrowser = FleetBrowser(self.notebookBrowsers)
        #self.notebookBrowsers.AddPage(self.fleetBrowser, "Fleets", showClose = False)
        #=======================================================================

        self.notebookBrowsers.SetSelection(1)

        self.browser_fitting_split.SplitVertically(
            self.notebookBrowsers, self.fitting_additions_split)
        self.browser_fitting_split.SetMinimumPaneSize(204)
        self.browser_fitting_split.SetSashPosition(self.browserWidth)

        self.fitting_additions_split.SplitHorizontally(self.fitMultiSwitch,
                                                       self.additionsPane,
                                                       -200)
        self.fitting_additions_split.SetMinimumPaneSize(200)
        self.fitting_additions_split.SetSashPosition(self.fittingHeight)
        self.fitting_additions_split.SetSashGravity(1.0)

        cstatsSizer = wx.BoxSizer(wx.VERTICAL)

        self.charSelection = CharacterSelection(self)
        cstatsSizer.Add(self.charSelection, 0, wx.EXPAND)

        self.statsPane = StatsPane(self)
        cstatsSizer.Add(self.statsPane, 0, wx.EXPAND)

        mainSizer.Add(cstatsSizer, 0, wx.EXPAND)

        self.SetSizer(mainSizer)

        #Add menu
        self.addPageId = wx.NewId()
        self.closePageId = wx.NewId()

        self.widgetInspectMenuID = wx.NewId()
        self.SetMenuBar(MainMenuBar())
        self.registerMenu()

        #Internal vars to keep track of other windows (graphing/stats)
        self.graphFrame = None
        self.statsWnds = []
        self.activeStatsWnd = None

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

        #Show ourselves
        self.Show()

        self.LoadPreviousOpenFits()

        #Check for updates
        self.sUpdate = service.Update.getInstance()
        self.sUpdate.CheckUpdate(self.ShowUpdateBox)

        if not 'wxMac' in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo
                                              and wx.VERSION >= (3, 0)):
            self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin)
            self.Bind(GE.EVT_SSO_LOGOUT, self.onSSOLogout)

        self.titleTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.updateTitle, self.titleTimer)
Exemplo n.º 5
0
 def get_icon():
    return wx.IconFromBitmap(gamera_icons.getIconImageUnknownBitmap())
Exemplo n.º 6
0
 def set_icon(self, path):
     icon = wx.IconFromBitmap(wx.Bitmap(path))
     self.SetIcon(icon, check_output(['pvpn', '--status']))
Exemplo n.º 7
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          wx.ID_ANY,
                          title="pyfa - Python Fitting Assistant")

        MainFrame.__instance = self

        #Load stored settings (width/height/maximized..)
        self.LoadMainFrameAttribs()

        #Fix for msw (have the frame background color match panel color
        if 'wxMSW' in wx.PlatformInfo:
            self.SetBackgroundColour(
                wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))

        #Load and set the icon for pyfa main window
        i = wx.IconFromBitmap(bitmapLoader.getBitmap("pyfa", "icons"))
        self.SetIcon(i)

        #Create the layout and windows
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)

        mainSizer.Add(self.splitter, 1, wx.EXPAND | wx.LEFT, 2)

        self.FitviewAdditionsPanel = PFPanel(self.splitter)
        faSizer = wx.BoxSizer(wx.VERTICAL)

        self.fitMultiSwitch = MultiSwitch(self.FitviewAdditionsPanel)

        faSizer.Add(self.fitMultiSwitch, 1, wx.EXPAND)

        self.additionsPane = AdditionsPane(self.FitviewAdditionsPanel)
        faSizer.Add(self.additionsPane, 0, wx.EXPAND)

        self.FitviewAdditionsPanel.SetSizer(faSizer)

        self.notebookBrowsers = gui.chromeTabs.PFNotebook(self.splitter, False)

        marketImg = bitmapLoader.getImage("market_small", "icons")
        shipBrowserImg = bitmapLoader.getImage("ship_small", "icons")

        self.marketBrowser = MarketBrowser(self.notebookBrowsers)
        self.notebookBrowsers.AddPage(self.marketBrowser,
                                      "Market",
                                      tabImage=marketImg,
                                      showClose=False)

        self.shipBrowser = ShipBrowser(self.notebookBrowsers)
        self.notebookBrowsers.AddPage(self.shipBrowser,
                                      "Ships",
                                      tabImage=shipBrowserImg,
                                      showClose=False)

        #=======================================================================
        # DISABLED FOR RC2 RELEASE
        #self.fleetBrowser = FleetBrowser(self.notebookBrowsers)
        #self.notebookBrowsers.AddPage(self.fleetBrowser, "Fleets", showClose = False)
        #=======================================================================

        self.notebookBrowsers.SetSelection(1)

        self.splitter.SplitVertically(self.notebookBrowsers,
                                      self.FitviewAdditionsPanel)
        self.splitter.SetMinimumPaneSize(204)
        self.splitter.SetSashPosition(300)

        cstatsSizer = wx.BoxSizer(wx.VERTICAL)

        self.charSelection = CharacterSelection(self)
        cstatsSizer.Add(self.charSelection, 0, wx.EXPAND)

        self.statsPane = StatsPane(self)
        cstatsSizer.Add(self.statsPane, 0, wx.EXPAND)

        mainSizer.Add(cstatsSizer, 0, wx.EXPAND)

        self.SetSizer(mainSizer)

        #Add menu
        self.addPageId = wx.NewId()
        self.closePageId = wx.NewId()

        self.widgetInspectMenuID = wx.NewId()
        self.SetMenuBar(MainMenuBar())
        self.registerMenu()

        #Internal vars to keep track of other windows (graphing/stats)
        self.graphFrame = None
        self.statsWnds = []
        self.activeStatsWnd = None

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

        #Show ourselves
        self.Show()
Exemplo n.º 8
0
def GetClearOutputIcon():
    return wx.IconFromBitmap(GetClearOutputBitmap())
Exemplo n.º 9
0
    def __init__(self):

        self.MWLOG = logging.getLogger('MWSETUP')
        self.prev_installation = False

        try:
            base_path = sys._MEIPASS + '\\'
            print 'Start from EXE ... Working in ->'
            print base_path
        except Exception:
            print 'Start from script ... Working in ->'
            base_path = os.path.abspath(".") + '\\'
            print base_path

        self.root_reg_key = r'Software\McNeel\Rhinoceros\\'
        self.MW_reg_key = r'Software\MW\3DPrinting\\'

        self.postfix_installation_folder = r'\MW3DPrinting\\'
        self.icon_main = base_path + r'bin\images\install.ico'

        self.toolbar_folder = r'Plug-ins\Toolbars\\'
        self.toolbar_file = r'MW3DPrint_TB.rui'

        self.editbox = []

        wx.Dialog.__init__(self,
                           None,
                           title='MW Installer - 3D Printing for Rhino',
                           size=UI.WMAIN['size'],
                           style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                           | wx.TAB_TRAVERSAL
                           )  # | wx.RESIZE_BORDER)  # | wx.TRANSPARENT_WINDOW)

        self.win_style = self.GetWindowStyle()
        self.SetWindowStyle(self.win_style | wx.STAY_ON_TOP)

        icon = wx.IconFromBitmap(wx.Bitmap(self.icon_main))
        self.SetIcon(icon)

        # self.png = wx.StaticBitmap(self, -1, wx.Bitmap(r"bin\images\down.png", wx.BITMAP_TYPE_ANY))

        # self.png.Pos

        self.SetSizeWH(UI.WMAIN['size'][0], UI.WMAIN['size'][1])

        self.SetBackgroundColour(
            wx.Colour(UI.WCOLOR['BG'][0], UI.WCOLOR['BG'][1],
                      UI.WCOLOR['BG'][2]))

        atable = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_ESCAPE,
                                       wx.ID_EXIT)])
        self.SetAcceleratorTable(atable)
        wx.EVT_MENU(self, wx.ID_EXIT, self.close_IS)

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

        self.Center()
        self.Show()

        self.current_y_pxpos_elem = 0

        # TEXT HEADER
        # _______________________________________________________________________________

        label = 'Please enter information below to start MW 3D Printer installation.'

        text = wx.StaticText(
            self,
            label=label,
            pos=(UI.THEADERSTART['pos'][0],
                 UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem))

        text.SetForegroundColour(UI.TCOLOR['FG'])  # set text color

        self.current_y_pxpos_elem += 40

        # TEXT RHINO
        # _______________________________________________________________________________

        label = 'Rhino installation folder:'

        text = wx.StaticText(
            self,
            label=label,
            pos=(UI.THEADERSTART['pos'][0],
                 UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem))

        text.SetForegroundColour(UI.ECOLOR2['FG'])  # set text color

        self.current_y_pxpos_elem += 15

        # EDITBOX RHINO
        # _______________________________________________________________________________

        self.editbox.append((wx.TextCtrl(
            self,
            name='path_Rhino',
            pos=(UI.THEADERSTART['pos'][0],
                 UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem),
            size=(UI.WMAIN['size'][0] - 45, UI.EBOX['size'][1]),
            style=wx.TE_PROCESS_ENTER)))

        self.editbox[0].SetForegroundColour(UI.ECOLOR2['FG'])  # set color
        self.editbox[0].SetBackgroundColour(UI.WCOLOR['BG'])  # set color
        self.editbox[0].Bind(wx.EVT_KEY_DOWN, self.installOK)

        try:
            print 'Searching for Rhino installation ...'
            key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
                                  self.root_reg_key)
        except:
            key = None
            message = 'There is no Rhino installed. Visit http://www.rhino3d.com/download/ to get your version.'
            print message
            return

        if key is not None:
            i = 0
            while 1:
                try:
                    subkey = _winreg.EnumKey(key, i)
                    if subkey.find('x') != -1:
                        print 'Rhino version ' + subkey.split('x')[
                            0] + ' - ' + subkey.split('x')[1] + ' bit found.'

                        label = 'Rhino version ' + subkey.split('x')[
                            0] + ' - ' + subkey.split('x')[1] + ' bit - found'

                        text = wx.StaticText(self,
                                             label=label,
                                             pos=(UI.THEADERSTART['pos'][0],
                                                  UI.THEADERSTART['pos'][1] +
                                                  self.current_y_pxpos_elem))

                        text.SetForegroundColour(
                            UI.PARAMCOLOR['FG'])  # set text color

                        self.current_y_pxpos_elem += 15

                        self.RhinoFound = True

                        break

                    i += 1
                except:
                    break

            key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
                                  self.root_reg_key + subkey + "\\Install")
            reg_value = _winreg.QueryValueEx(key, "InstallPath")[0]

            self.reg_rhino_folder = reg_value

            self.editbox[0].SetValue(reg_value)
            self.editbox[0].MoveXY(
                UI.THEADERSTART['pos'][0],
                UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem)

        else:
            self.RhinoFound = False

            label = 'No Rhino installation found.\n' \
                    'Visit www.Rhino3d.com to download the latest version.'

            text = wx.StaticText(
                self,
                label=label,
                pos=(UI.THEADERSTART['pos'][0],
                     UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem))

            text.SetForegroundColour(UI.TERROR['FG'])  # set text color

            self.current_y_pxpos_elem += 15
            self.editbox[0].Hide()

        self.current_y_pxpos_elem += 30

        # TEXT INSTALL CORE
        # _______________________________________________________________________________

        label = 'Enter installation folder. Do not install into ProgramFiles folder:'

        text = wx.StaticText(
            self,
            label=label,
            pos=(UI.THEADERSTART['pos'][0],
                 UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem))

        text.SetForegroundColour(UI.ECOLOR2['FG'])  # set text color

        self.current_y_pxpos_elem += 15

        # EDITBOX CORE PATH
        # _______________________________________________________________________________

        self.editbox.append((wx.TextCtrl(
            self,
            name='path_Rhino',
            pos=(UI.THEADERSTART['pos'][0],
                 UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem),
            size=(UI.WMAIN['size'][0] - 70, UI.EBOX['size'][1]),
            style=wx.TE_PROCESS_ENTER)))

        self.editbox[1].SetForegroundColour(UI.ECOLOR2['FG'])  # set color
        self.editbox[1].SetBackgroundColour(UI.WCOLOR['BG'])  # set color
        self.editbox[1].Bind(wx.EVT_KEY_DOWN, self.installOK)

        try:
            key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, self.MW_reg_key)
            core_path = _winreg.QueryValue(key, 'CorePath')
            self.reg_core_path = core_path
            self.config_file = _winreg.QueryValue(key, 'ConfigFile')

            if core_path[-1] == '\\\\':
                core_path = core_path.decode('string_escape')

            label = 'Previous installation found in'
            self.prev_installation = True

            text = wx.StaticText(
                self,
                label=label,
                pos=(UI.THEADERSTART['pos'][0],
                     UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem))

            text.SetForegroundColour(UI.PARAMCOLOR['FG'])  # set text color

            self.current_y_pxpos_elem += 15

            self.editbox[1].SetValue(core_path)
            self.editbox[1].MoveXY(
                UI.THEADERSTART['pos'][0],
                UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem)
        except Exception as e:
            self.MWLOG.exception('REGKEY')
            self.editbox[1].SetValue(
                os.environ['PROGRAMFILES'][0:2] +
                self.postfix_installation_folder.decode('string_escape'))

        # BUTTON CHOOSE FOLDER
        # _______________________________________________________________________________
        self.button_choose_folder = wx.Button(
            self,
            label='...',
            size=[20, 20],
            pos=[455, UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem])

        self.button_choose_folder.SetForegroundColour((250, 250, 250))
        self.button_choose_folder.SetBackgroundColour((80, 80, 80))
        self.button_choose_folder.Bind(wx.EVT_BUTTON, self.choose_folder)

        self.current_y_pxpos_elem += 30

        # CHECKBOX
        # _______________________________________________________________________________
        # CheckBox(parent, id=ID_ANY, label="", pos=DefaultPosition,
        #          size=DefaultSize, style=0, validator=DefaultValidator,
        #          name=CheckBoxNameStr)

        # checkbox = wx.CheckBox(self,
        #                       label='Install Rhino tool bar',
        #                       pos=(UI.THEADERSTART['pos'][0], UI.THEADERSTART['pos'][1] + self.current_y_pxpos_elem))

        # checkbox.SetForegroundColour(UI.ECOLOR2['FG'])
        # checkbox.SetValue(1)

        # BUTTON (INSTALL)
        # _______________________________________________________________________________

        label = 'INSTALL'

        pos = (UI.WMAIN['size'][0] - 70, UI.WMAIN['size'][1] - 50)

        self.button_install = wx.StaticText(self, label=label, pos=pos)

        self.button_install.SetForegroundColour(UI.ECOLOR2['FG'])

        self.button_install.Bind(wx.EVT_MOTION, self.installOver)
        self.button_install.Bind(wx.EVT_LEFT_DOWN, self.installDOWN)

        if self.RhinoFound:
            self.button_install.Bind(wx.EVT_LEFT_UP, self.installOK)
        else:
            self.button_install.SetLabel('EXIT')
            self.button_install.Bind(wx.EVT_LEFT_UP, self.close_IS)

        # BUTTON (UNINSTALL)
        # __________________________________________________________________

        if self.prev_installation:

            label = 'UNINSTALL'

            pos = (UI.WMAIN['size'][0] - 480, UI.WMAIN['size'][1] - 50)

            self.button_uninstall = wx.StaticText(self, label=label, pos=pos)

            self.button_uninstall.SetForegroundColour(UI.ECOLOR2['FG'])

            self.button_uninstall.Bind(wx.EVT_MOTION, self.uninstallOver)
            self.button_uninstall.Bind(wx.EVT_LEFT_DOWN, self.uninstallDOWN)

            self.button_uninstall.Bind(wx.EVT_LEFT_UP, self.uninstallOK)
Exemplo n.º 10
0
def GetAddWatchIcon():
    return wx.IconFromBitmap(GetAddWatchBitmap())
Exemplo n.º 11
0
def GetBreakIcon():
    return wx.IconFromBitmap(GetBreakBitmap())
Exemplo n.º 12
0
def GetStepReturnIcon():
    return wx.IconFromBitmap(GetStepReturnBitmap())
Exemplo n.º 13
0
def GetStopIcon():
    return wx.IconFromBitmap(GetStopBitmap())
Exemplo n.º 14
0
def GetNextIcon():
    return wx.IconFromBitmap(GetNextBitmap())
Exemplo n.º 15
0
def getPerlIcon():
    return wx.IconFromBitmap(getPerlBitmap())
Exemplo n.º 16
0
    def __init__(self, parent, DefaultFilterData_=None, Env_=None):
        """
        Конструктор.
        """
        try:
            _title = u'Конструктор фильтров'

            pre = wx.PreDialog()
            pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
            pre.Create(parent,
                       -1,
                       title=_title,
                       style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                       pos=wx.DefaultPosition,
                       size=wx.Size(900, 400))

            # This next step is the most important, it turns this Python
            # object into the real wrapper of the dialog (instead of pre)
            # as far as the wxPython extension is concerned.
            self.PostCreate(pre)

            # Определение иконки диалогового окна
            icon = None
            try:
                from ic.imglib import newstyle_img
                icon_img = newstyle_img.data_filter
            except:
                icon_img = ic_bmp.getSysImg('imgFilter')
            if icon_img:
                icon = wx.IconFromBitmap(icon_img)
            if icon:
                self.SetIcon(icon)

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

            self._button_boxsizer = wx.BoxSizer(wx.HORIZONTAL)

            # Кнопка -OK-
            id_ = wx.NewId()
            self._ok_button = wx.Button(self, id_, u'OK', size=wx.Size(-1, -1))
            self.Bind(wx.EVT_BUTTON, self.OnOK, id=id_)
            # Кнопка -Отмена-
            id_ = wx.NewId()
            self._cancel_button = wx.Button(self,
                                            id_,
                                            u'Отмена',
                                            size=wx.Size(-1, -1))
            self.Bind(wx.EVT_BUTTON, self.OnCancel, id=id_)

            self._button_boxsizer.Add(self._ok_button, 0,
                                      wx.ALIGN_CENTRE | wx.ALL, 10)
            self._button_boxsizer.Add(self._cancel_button, 0,
                                      wx.ALIGN_CENTRE | wx.ALL, 10)

            global filter_constructor
            if filter_constructor is None:
                from . import filter_constructor

            self._filter_constructor_ctrl = filter_constructor.icFilterConstructorTreeList(
                self)

            if Env_:
                # Устанивить окружение работы конструктора фильтров
                self._filter_constructor_ctrl.setEnvironment(Env_)

            # Если надо то установить редатируемый список паспортов
            if DefaultFilterData_:
                self._filter_constructor_ctrl.setFilterData(DefaultFilterData_)
            else:
                self._filter_constructor_ctrl.setDefault()

            self._boxsizer.Add(self._filter_constructor_ctrl, 1,
                               wx.EXPAND | wx.GROW, 0)
            self._boxsizer.Add(self._button_boxsizer, 0, wx.ALIGN_RIGHT, 10)

            self.SetSizer(self._boxsizer)
            self.SetAutoLayout(True)
        except:
            io_prnt.outErr(
                u'Ошибка создания объекта диалогового окна конструктора фильтров'
            )
Exemplo n.º 17
0
    def __init__(self, parent, fileName):

        self.parent = parent
        self.fileName = fileName

        self.normalFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.normalFont.SetPointSize(self.normalFont.GetPointSize() + 1)
        self.smallerFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)

        self.greyColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)

        if os.path.isdir(fileName):
            self.text = fileName
            bitmap = wx.Bitmap(os.path.join(bitmapDir, "folder.png"),
                               wx.BITMAP_TYPE_PNG)
            self.icon = wx.IconFromBitmap(bitmap)
            self.description = ""
            return

        self.text = os.path.split(fileName)[1]
        extension = os.path.splitext(fileName)[1]

        if not extension:
            self.text = fileName
            bitmap = wx.Bitmap(os.path.join(bitmapDir, "empty_icon.png"),
                               wx.BITMAP_TYPE_PNG)
            self.icon = wx.IconFromBitmap(bitmap)
            self.description = "File"
            return

        fileType = wx.TheMimeTypesManager.GetFileTypeFromExtension(extension)

        bmp = wx.Bitmap(os.path.join(bitmapDir, "empty_icon.png"),
                        wx.BITMAP_TYPE_PNG)
        bmp = wx.IconFromBitmap(bmp)

        if not fileType:
            icon = wx.IconFromLocation(wx.IconLocation(fileName))
            if not icon.IsOk():
                self.icon = bmp
            else:
                self.icon = icon

            self.description = "%s File" % extension[1:].upper()
            return

        #------- Icon info
        info = fileType.GetIconInfo()
        icon = None

        if info is not None:
            icon, file, idx = info
            if icon.IsOk():
                bmp = icon
            else:
                icon = None

        if icon is None:
            icon = wx.IconFromLocation(wx.IconLocation(fileName))
            if icon.IsOk():
                bmp = icon
            else:
                command = fileType.GetOpenCommand(fileName)
                command = " ".join(command.split()[0:-1])
                command = command.replace('"', "")
                if " -" in command:
                    command = command[0:command.index(" -")]

                icon = wx.IconFromLocation(wx.IconLocation(command))
                if icon.IsOk():
                    bmp = icon

        self.icon = bmp
        self.description = convert(fileType.GetDescription())

        if not self.description:
            self.description = "%s File" % extension[1:].upper()
Exemplo n.º 18
0
 def __new__(cls, *args, **kwargs):
     if isinstance(args[0], wx._core.Bitmap):
         return wx.IconFromBitmap(*args, **kwargs)
     return super(IconClever, cls).__new__(cls, *args, **kwargs)
Exemplo n.º 19
0
 def set_icon(self, path):
     icon = wx.IconFromBitmap(wx.Bitmap(path))
     self.SetIcon(icon, TRAY_TOOLTIP)
Exemplo n.º 20
0
    def __init__(self,
                 parent,
                 style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE
                 | wx.FRAME_FLOAT_ON_PARENT):
        global graphFrame_enabled
        global mplImported
        global mpl_version

        self.legendFix = False

        if not graphFrame_enabled:
            pyfalog.warning(
                "Matplotlib is not enabled. Skipping initialization.")
            return

        try:
            cache_dir = mpl._get_cachedir()
        except:
            cache_dir = os.path.expanduser(os.path.join("~", ".matplotlib"))

        cache_file = os.path.join(cache_dir, 'fontList.cache')

        if os.access(cache_dir,
                     os.W_OK | os.X_OK) and os.path.isfile(cache_file):
            # remove matplotlib font cache, see #234
            os.remove(cache_file)
        if not mplImported:
            mpl.use('wxagg')

        graphFrame_enabled = True
        if int(mpl.__version__[0]) < 1:
            print("pyfa: Found matplotlib version ", mpl.__version__,
                  " - activating OVER9000 workarounds")
            print("pyfa: Recommended minimum matplotlib version is 1.0.0")
            self.legendFix = True

        mplImported = True

        wx.Frame.__init__(self,
                          parent,
                          title=u"pyfa: Graph Generator",
                          style=style,
                          size=(520, 390))

        i = wx.IconFromBitmap(BitmapLoader.getBitmap("graphs_small", "gui"))
        self.SetIcon(i)
        self.mainFrame = gui.mainFrame.MainFrame.getInstance()
        self.CreateStatusBar()

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.mainSizer)

        sFit = Fit.getInstance()
        fit = sFit.getFit(self.mainFrame.getActiveFit())
        self.fits = [fit] if fit is not None else []
        self.fitList = FitList(self)
        self.fitList.SetMinSize((270, -1))

        self.fitList.fitList.update(self.fits)

        self.graphSelection = wx.Choice(self, wx.ID_ANY, style=0)
        self.mainSizer.Add(self.graphSelection, 0, wx.EXPAND)

        self.figure = Figure(figsize=(4, 3))

        rgbtuple = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get()
        clr = [c / 255. for c in rgbtuple]
        self.figure.set_facecolor(clr)
        self.figure.set_edgecolor(clr)

        self.canvas = Canvas(self, -1, self.figure)
        self.canvas.SetBackgroundColour(wx.Colour(*rgbtuple))

        self.subplot = self.figure.add_subplot(111)
        self.subplot.grid(True)

        self.mainSizer.Add(self.canvas, 1, wx.EXPAND)
        self.mainSizer.Add(
            wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
                          wx.LI_HORIZONTAL), 0, wx.EXPAND)

        self.gridPanel = wx.Panel(self)
        self.mainSizer.Add(self.gridPanel, 0, wx.EXPAND)

        dummyBox = wx.BoxSizer(wx.VERTICAL)
        self.gridPanel.SetSizer(dummyBox)

        self.gridSizer = wx.FlexGridSizer(0, 4)
        self.gridSizer.AddGrowableCol(1)
        dummyBox.Add(self.gridSizer, 0, wx.EXPAND)

        for view in Graph.views:
            view = view()
            self.graphSelection.Append(view.name, view)

        self.graphSelection.SetSelection(0)
        self.fields = {}
        self.select(0)
        self.sl1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                 wx.DefaultSize, wx.LI_HORIZONTAL)
        self.mainSizer.Add(self.sl1, 0, wx.EXPAND)
        self.mainSizer.Add(self.fitList, 0, wx.EXPAND)

        self.fitList.fitList.Bind(wx.EVT_LEFT_DCLICK, self.removeItem)
        self.mainFrame.Bind(GE.FIT_CHANGED, self.draw)
        self.Bind(wx.EVT_CLOSE, self.close)

        self.Fit()
        self.SetMinSize(self.GetSize())
Exemplo n.º 21
0
    def __init__(self,
                 parent,
                 style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE
                 | wx.FRAME_FLOAT_ON_PARENT):

        global enabled
        global mplImported

        self.legendFix = False
        if not enabled:
            return

        try:
            import matplotlib as mpl
            if not mplImported:
                mpl.use('wxagg')
            from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
            from matplotlib.figure import Figure
            enabled = True
            if mpl.__version__[0] != "1":
                print "pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds"
                print "pyfa: Recommended minimum matplotlib version is 1.0.0"
                self.legendFix = True
        except:
            print "Problems importing matplotlib; continuing without graphs"
            enabled = False
            return

        mplImported = True

        wx.Frame.__init__(self,
                          parent,
                          title=u"pyfa: Graph Generator",
                          style=style,
                          size=(520, 390))

        i = wx.IconFromBitmap(bitmapLoader.getBitmap("graphs_small", "icons"))
        self.SetIcon(i)
        self.mainFrame = gui.mainFrame.MainFrame.getInstance()
        self.CreateStatusBar()

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.mainSizer)

        sFit = service.Fit.getInstance()
        fit = sFit.getFit(self.mainFrame.getActiveFit())
        self.fits = [fit] if fit is not None else []
        self.fitList = FitList(self)
        self.fitList.SetMinSize((270, -1))

        self.fitList.fitList.update(self.fits)

        self.graphSelection = wx.Choice(self, wx.ID_ANY, style=0)
        self.mainSizer.Add(self.graphSelection, 0, wx.EXPAND)

        self.figure = Figure(figsize=(4, 3))

        rgbtuple = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get()
        clr = [c / 255. for c in rgbtuple]
        self.figure.set_facecolor(clr)
        self.figure.set_edgecolor(clr)

        self.canvas = Canvas(self, -1, self.figure)
        self.canvas.SetBackgroundColour(wx.Colour(*rgbtuple))

        self.subplot = self.figure.add_subplot(111)
        self.subplot.grid(True)

        self.mainSizer.Add(self.canvas, 1, wx.EXPAND)
        self.mainSizer.Add(
            wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
                          wx.LI_HORIZONTAL), 0, wx.EXPAND)

        self.gridPanel = wx.Panel(self)
        self.mainSizer.Add(self.gridPanel, 0, wx.EXPAND)

        dummyBox = wx.BoxSizer(wx.VERTICAL)
        self.gridPanel.SetSizer(dummyBox)

        self.gridSizer = wx.FlexGridSizer(0, 4)
        self.gridSizer.AddGrowableCol(1)
        dummyBox.Add(self.gridSizer, 0, wx.EXPAND)

        for view in Graph.views:
            view = view()
            self.graphSelection.Append(view.name, view)

        self.graphSelection.SetSelection(0)
        self.fields = {}
        self.select(0)
        self.sl1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                 wx.DefaultSize, wx.LI_HORIZONTAL)
        self.mainSizer.Add(self.sl1, 0, wx.EXPAND)
        self.mainSizer.Add(self.fitList, 0, wx.EXPAND)

        self.fitList.fitList.Bind(wx.EVT_LEFT_DCLICK, self.removeItem)
        self.mainFrame.Bind(GE.FIT_CHANGED, self.draw)
        self.Bind(wx.EVT_CLOSE, self.close)

        self.Fit()
        self.SetMinSize(self.GetSize())
Exemplo n.º 22
0
def getPHPIcon():
    return wx.IconFromBitmap(getPHPBitmap())
Exemplo n.º 23
0
 def to_icon(bitmap):
    if has_gui.has_gui:
       return wx.IconFromBitmap(bitmap)
    else:
       return None
Exemplo n.º 24
0
def get_icon(name):
    return wx.IconFromBitmap( get_bitmap(name) )
Exemplo n.º 25
0
 def get_icon():
    return wx.IconFromBitmap(gamera_icons.getIconImageComplexBitmap())
Exemplo n.º 26
0
    def __init__(self,
                 victim,
                 fullContext=None,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 maximized=False):

        wx.Dialog.__init__(self,
                           gui.mainFrame.MainFrame.getInstance(),
                           wx.ID_ANY,
                           title="Item stats",
                           pos=pos,
                           size=size,
                           style=wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX
                           | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER
                           | wx.SYSTEM_MENU)

        empty = getattr(victim, "isEmpty", False)

        if empty:
            self.Hide()
            self.Destroy()
            return

        srcContext = fullContext[0]
        try:
            itmContext = fullContext[1]
        except IndexError:
            itmContext = None
        item = getattr(victim, "item", None) if srcContext.lower() not in (
            "projectedcharge",
            "fittingcharge") else getattr(victim, "charge", None)
        if item is None:
            sMkt = service.Market.getInstance()
            item = sMkt.getItem(victim.ID)
            victim = None
        self.context = itmContext
        if item.icon is not None:
            before, sep, after = item.icon.iconFile.rpartition("_")
            iconFile = "%s%s%s" % (before, sep,
                                   "0%s" % after if len(after) < 2 else after)
            itemImg = BitmapLoader.getBitmap(iconFile, "icons")
            if itemImg is not None:
                self.SetIcon(wx.IconFromBitmap(itemImg))
        self.SetTitle(
            "%s: %s%s" %
            ("%s Stats" % itmContext if itmContext is not None else "Stats",
             item.name, " (%d)" % item.ID if config.debug else ""))

        self.SetMinSize((300, 200))
        if "wxGTK" in wx.PlatformInfo:  # GTK has huge tab widgets, give it a bit more room
            self.SetSize((530, 300))
        else:
            self.SetSize((500, 300))
        #self.SetMaxSize((500, -1))
        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.container = ItemStatsContainer(self, victim, item, itmContext)
        self.mainSizer.Add(self.container, 1, wx.EXPAND)

        if "wxGTK" in wx.PlatformInfo:
            self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close",
                                      wx.DefaultPosition, wx.DefaultSize, 0)
            self.mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5)
            self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent)

        self.SetSizer(self.mainSizer)

        self.parentWnd = gui.mainFrame.MainFrame.getInstance()

        dlgsize = self.GetSize()
        psize = self.parentWnd.GetSize()
        ppos = self.parentWnd.GetPosition()

        ItemStatsDialog.counter += 1
        self.dlgOrder = ItemStatsDialog.counter

        counter = ItemStatsDialog.counter
        dlgStep = 30
        if counter * dlgStep > ppos.x + psize.width - dlgsize.x or counter * dlgStep > ppos.y + psize.height - dlgsize.y:
            ItemStatsDialog.counter = 1

        dlgx = ppos.x + counter * dlgStep
        dlgy = ppos.y + counter * dlgStep
        if pos == wx.DefaultPosition:
            self.SetPosition((dlgx, dlgy))
        else:
            self.SetPosition(pos)
        if maximized:
            self.Maximize(True)
        else:
            if size != wx.DefaultSize:
                self.SetSize(size)
        self.parentWnd.RegisterStatsWindow(self)

        self.Show()

        self.Bind(wx.EVT_CLOSE, self.closeEvent)
        self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
Exemplo n.º 27
0
 def get_icon():
    return wx.IconFromBitmap(gamera_icons.getIconSubimageGrey16Bitmap())
Exemplo n.º 28
0
def getXMLIcon():
    return wx.IconFromBitmap(getXMLBitmap())
Exemplo n.º 29
0
 def get_icon():
    return wx.IconFromBitmap(gamera_icons.getIconSubimageBinaryBitmap())
Exemplo n.º 30
0
def GetCloseIcon():
    return wx.IconFromBitmap(GetCloseBitmap())