TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #62 · 4 апр.

Когда разрабатываете свой GUI с помощью PyQt для какого-либо софта бывает необходимо позаимствовать цвета из текущего стиля интерфейса. Например, чтобы правильно раскрасить свои виджеты, подогнав их по цвету. Ведь бывает, что ваш GUI используется в разных софтах. Причём некоторые со светлой темой а другие с тёмной. По умолчанию стили наследуются, но если вы задаёте какую-либо раскраску для части виджета через свой styleSheet, то требуется ссылаться на цвета текущего стиля. Как это сделать? Как получить нужный цвет из палитры имеющегося стиля? Это достаточно просто, нужно использовать класс QPalette и его роли. Например, мне нужно достать цвет текста из одного виджета и применить его в другом как цвет фона (не важно зачем именно так, просто захотелось😊). Получаем палитру виджета и сразу достаём нужный цвет, указав его роль. from PySide2.QtGui import QPalette color = main_window.palette().color(QPalette.Text) теперь можем использовать этот цвет в стилях my_widget.setStyleSheet(f'background-color: {color.name()};') Готово, мы динамически переопределили дефолтный стиль используя текущий стиль окна! На самом деле есть запись покороче, в одну строку и без лишних переменных. Не очень-то по правилам CSS, но Qt это понимает. my_widget.setStyleSheet('background-color: palette(Text);') Этот способ не подходит если вам нужно как-то модифицировать цвет перед применением в своих стилях. В этом случае потребуется первый способ. Зато он прекрасно сработает в файле .qss, то есть не придётся в коде прописывать раскраску отдельных элементов через ссылки на палитру, всё красиво сохранится в отдельном файле .qss! QListView#my_widget::item:selected { background: palette(Midlight); } Про имеющиеся роли можно почитать здесь🌍 #qt#tricks

Hashtags

Резултати

Пронајдени 1 слични објави

Пребарај: #cocaoboom

当前筛选 #cocaoboom清除筛选

☕🍫 ETHIOPIA'S GOLDEN OPPORTUNITY The Coffee Paradox and the Cocoa Revolution That Never Happened 🌍COFFEE WORTH ITS WEIGHT IN GOLD Ethiopian coffee is not just a beverage. It's liquid history. Hand-picked at dawn, processed by generations of knowledge, grown in the birthplace of coffee itself — the highlands where the first beans were discovered over 1,000 years ago. This coffee should cost like gold. Because it IS gold. Specialty Ethiopian coffee: \$40-100 per kilogram. Single-origin Yirgacheffe, Sidamo, Harrar — these names are revered in specialty coffee circles worldwide. Roasters in Tokyo, London, New York pay premium prices for these beans. ይህ ቡና ወርቅ ነው። በእጅ የተሰበሰበ፣ በትውፊት የተቀነባበረ፣ በወርቅ ዋጋ መሸጥ አለበት። (This coffee is gold. Hand-picked, traditionally processed, it should sell at gold's price.) But here's the brutal truth: In the mass market — supermarkets, chain cafés, everyday consumption — Ethiopia struggles to compete with Brazil, Colombia, Vietnam. Not because our coffee is inferior. But because Western producers mastered marketing decades ago. They built brands. Created stories. Dominated distribution. Эфиопский кофе проигрывает не по качеству, а по маркетингу. (Ethiopian coffee doesn't lose on quality, but on marketing.) --- 🍫THE COCOA BOOM THAT PASSED US BY While Ethiopia focused on coffee, something extraordinary happened in West Africa. The global cocoa market exploded. 2024 cocoa prices: \$10,000+ per ton — a historic record. Demand is surging. Chocolate consumption in Asia, artisan chocolate movement in the West, premium dark chocolate market — the world cannot get enough cocoa. Who's winning? Côte d'Ivoire, Ghana, Cameroon. They produce 70% of the world's cocoa. African nations dominate the market. Production is expanding. Farmers are profiting. Economies are growing. የአፍሪካ አገሮች የአለምን ካካኦ 70% ያመርታሉ። ዋጋው እየጨመረ ነው። ግን ኢትዮጵያ የት ነች? (African countries produce 70% of world's cocoa. Prices are rising. But where is Ethiopia?) Ethiopia's cocoa production? Virtually zero. Давайте повторим: практически ноль. (Let's repeat: practically zero.) --- 🌱THE MADNESS OF MISSED OPPORTUNITY Here's what makes this absurd: Ethiopia has PERFECT conditions for cocoa cultivation. Southwestern Ethiopia — regions like Bench Maji, Kaffa (yes, the birthplace of coffee!), and Gambella — share the exact same climate as Ghana and Côte d'Ivoire: - Tropical highland climate - Rich volcanic soil - Consistent rainfall - Temperature range 18-32°C We have everything: - ✅ The land - ✅ The farmers with agricultural expertise - ✅ The climate - ✅ The infrastructure potential ኢትዮጵያ ለካካኦ ምርት ፍፁም ሁኔታ አላት። አፈር፣ የአየር ሁኔታ፣ ገበሬዎች። ሁሉም ነገር ዝግጁ ነው። (Ethiopia has perfect conditions for cocoa production. Soil, climate, farmers. Everything is ready.) What we DON'T have: Production scale. Market presence. Investment in cocoa farming. --- 💎THE DUAL STRATEGY: LUXURY + OPPORTUNITY The solution isn't abandoning coffee. It's strategic diversification. COFFEE: Position Ethiopia as the ultra-premium, luxury origin. Not mass market — leave that to Brazil. Ethiopian coffee should be what Champagne is to wine. What Kobe beef is to meat. Exclusive. Prestigious. Worth the price. COCOA: Seize the African cocoa boom. West Africa showed the way — now it's Ethiopia's turn. Start cocoa cultivation in suitable regions. Partner with international chocolate makers. Create Ethiopian chocolate brands. Эфиопия может быть и родиной кофе, и новым лидером по какао. Две золотые культуры. (Ethiopia can be both the birthplace of coffee and a new cocoa leader. Two golden crops.) --- Ethiopia: birthplace of coffee, future of African cocoa. ወርቅ እና ቸኮሌት። (Gold and chocolate.) #EthiopianCoffee#CocaoOpportunity#AfricanAgriculture#Ethiopia#CoffeeCulture#CocaoBoom#Agribusiness🌍☕🍫