如何在 flatpak 的 PyQt5 应用程序中添加图标?

问题描述

我有一个小的 PyQt5 应用程序:https://github.com/taunoe/tauno-serial-plotter

我获得了在 flatpak 上运行的所有功能,但图标是个问题。尝试了不同的东西,但我不知道如何让它们出现。

(base) taunoerik@pop-os:~/Documents/MyGitHub/tauno-serial-plotter$ flatpak run
org.flatpak.Tauno-serial-plotter /app/bin/python3
Gtk-Message: 15:15:29.163: Failed to load module "appmenu-gtk-module"
Gtk-Message: 15:15:29.199: Failed to load module "canberra-gtk-module"
Gtk-Message: 15:15:29.199: Failed to load module "canberra-gtk-module"
Qt: Session management error: None of the authentication protocols specified are supported
qt.svg: Cannot open file '/home/taunoerik/img/tauno-plotter.svg',because: No such file or  directory
qt.svg: Cannot open file '/home/taunoerik/img/tauno-plotter.svg',because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/arrow_down.svg',because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/plus.svg',because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/minus.svg',because: No such file or directory

解决方法

文件名应该是绝对的。喜欢:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyjs)
mytitle <- paste0("")
dbHeader <- dashboardHeaderPlus(
  titleWidth = "0px",tags$li(a(
    div(style="display: inline;margin-top:-35px; padding: 0px 90px 0px 1250px ;font-size: 44px ;color:#001641;font-family:Chronicle Display Light; width: 500px;",HTML(mytitle)),div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;",actionButton("conse","Consent",style=" background-color: #faf0e6; border-color: #faf0e6") ),actionButton("rp","Run Project",actionButton("res","Results",),class = "dropdown")
)
shinyApp(
  ui = dashboardPagePlus(
    header = dbHeader,sidebar = dashboardSidebar(width = "0px",sidebarMenu(id = "sidebar",# id important for updateTabItems
                                           menuItem("Consent",tabName = "conse",icon = icon("line-chart")),menuItem("Results",tabName = "res",icon = icon("line-chart"))
                               )           
    ),body = dashboardBody(
      useShinyjs(),tags$script(HTML("$('body').addClass('fixed');")),tags$head(tags$style(".skin-blue .main-header .logo { padding: 0px;}")),actionButton("button","Get started",style='padding:4px; font-size:140%'),tabItems(
        tabItem("conse",conditionalPanel(condition = "input.conse >0 || input.button>0",textInput("nam",label = ("Name"),value = "")
                                 
                                 
                )
        ),tabItem("res",uiOutput('markdown')
                                 
        )
        
      )
      
    )
  ),server<-shinyServer(function(input,output,session) {
    hide(selector = "body > div > header > nav > a")
    
    observeEvent(input$button,{
      updateTabItems(session,"sidebar",selected = "conse")
      shinyjs::hide("button")
      
    })
    observeEvent(input$conse,selected = "conse")
      shinyjs::hide("button")
    })
    observeEvent(input$button,{
      if (input$nam=="") {
        updateTabItems(session,selected = "conse")
      }
      else{
          updateTabItems(session,selected = "res")
      }
      
    })
    observeEvent(input$rp,selected = "res")
        
      }
      
    })
    output$markdown <- renderUI({input$rp
      
      if (input$nam==""){
        return(NULL)
      }
      else{
        isolate(plot(iris))
          
      }
    })
  }
  )
)

像这样注意相对:filename = './icons/file.svg'